├── app
├── src
│ ├── main
│ │ ├── ic_launcher-web.png
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── values
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── drawable
│ │ │ │ ├── rounded_blue_button.xml
│ │ │ │ ├── forem_dialog_fragment_background.xml
│ │ │ │ ├── ic_baseline_arrow_downward_24.xml
│ │ │ │ ├── rounded_dialog.xml
│ │ │ │ ├── ic_compass.xml
│ │ │ │ ├── ic_news.xml
│ │ │ │ ├── ic_launcher_foreground.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── ic_forem_bot.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── layout
│ │ │ │ ├── activity_video_player.xml
│ │ │ │ ├── exo_player_control_view.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── forem_app_dialog.xml
│ │ ├── java
│ │ │ └── to
│ │ │ │ └── dev
│ │ │ │ └── dev_android
│ │ │ │ ├── events
│ │ │ │ ├── VideoPlayerPauseEvent.kt
│ │ │ │ ├── VideoPlayerTickEvent.kt
│ │ │ │ └── NetworkStatusEvent.kt
│ │ │ │ ├── util
│ │ │ │ ├── network
│ │ │ │ │ ├── NetworkStatus.kt
│ │ │ │ │ ├── NetworkUtils.kt
│ │ │ │ │ └── NetworkWatcher.kt
│ │ │ │ └── AndroidWebViewBridge.kt
│ │ │ │ ├── activities
│ │ │ │ ├── StarterApplication.kt
│ │ │ │ ├── BaseActivity.kt
│ │ │ │ ├── VideoPlayerActivity.kt
│ │ │ │ ├── ForemAppDialog.kt
│ │ │ │ └── MainActivity.kt
│ │ │ │ ├── webclients
│ │ │ │ ├── CustomWebChromeClient.kt
│ │ │ │ └── CustomWebViewClient.kt
│ │ │ │ └── media
│ │ │ │ ├── PodcastPlayerNotificationManager.kt
│ │ │ │ └── AudioService.kt
│ │ └── AndroidManifest.xml
│ ├── debug
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ ├── test
│ │ └── java
│ │ │ └── to
│ │ │ └── dev
│ │ │ └── dev_android
│ │ │ └── view
│ │ │ └── main
│ │ │ └── view
│ │ │ ├── CustomWebViewClientTest.kt
│ │ │ └── MainActivityTest.kt
│ └── androidTest
│ │ └── java
│ │ └── to
│ │ └── dev
│ │ └── dev_android
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle.kts
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── Gemfile
├── fastlane
├── Appfile
└── Fastfile
├── .idea
└── codeStyles
│ ├── codeStyleConfig.xml
│ └── Project.xml
├── .github
├── workflows
│ ├── cla.yml
│ ├── update-gradle-wrapper.yml
│ └── runOnGitHub.yml
├── PULL_REQUEST_TEMPLATE.md
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
└── fake-google-services.json
├── settings.gradle.kts
├── versions.properties
├── gradle.properties
├── .gitignore
├── gradlew.bat
├── CODE_OF_CONDUCT.md
├── README.md
├── Gemfile.lock
├── gradlew
├── CHANGELOG.md
├── config
└── detekt
│ └── detekt.yml
└── LICENSE
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/debug/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DEV (Debug)
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forem/DEV-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/events/VideoPlayerPauseEvent.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.events
2 |
3 | class VideoPlayerPauseEvent {
4 | val action = "pause"
5 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000000
4 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/events/VideoPlayerTickEvent.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.events
2 |
3 | class VideoPlayerTickEvent(val seconds: String) {
4 | val action = "tick"
5 | }
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/util/network/NetworkStatus.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.util.network
2 |
3 | enum class NetworkStatus {
4 | OFFLINE,
5 | BACK_ONLINE
6 | }
7 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 |
5 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6 |
7 | # gem "rails"
8 |
9 | gem "fastlane", "~> 2.166"
10 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/events/NetworkStatusEvent.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.events
2 |
3 | import to.dev.dev_android.util.network.NetworkStatus
4 |
5 | class NetworkStatusEvent(val networkStatus: NetworkStatus)
--------------------------------------------------------------------------------
/fastlane/Appfile:
--------------------------------------------------------------------------------
1 | json_key_file("./google-service-account-user.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
2 | package_name("to.dev.dev_android") # e.g. com.krausefx.app
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_blue_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/forem_dialog_fragment_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000000
4 | #000000
5 | #87DFD5
6 | #FFFFFF
7 | #000000
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_arrow_downward_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.github/workflows/cla.yml:
--------------------------------------------------------------------------------
1 | name: "CLA"
2 | on:
3 | issue_comment:
4 | types: [created]
5 | pull_request_target:
6 | types: [opened,closed,synchronize]
7 | merge_group:
8 | branches:
9 | - main
10 |
11 | permissions:
12 | actions: write
13 | contents: write
14 | pull-requests: write
15 | statuses: write
16 |
17 | jobs:
18 | check_cla:
19 | uses: forem/forem/.github/workflows/cla.yml@main
20 | secrets: inherit
21 |
--------------------------------------------------------------------------------
/.github/workflows/update-gradle-wrapper.yml:
--------------------------------------------------------------------------------
1 | name: Update Gradle Wrapper
2 |
3 | on:
4 | schedule:
5 | - cron: "0 0 * * *"
6 |
7 | jobs:
8 | update-gradle-wrapper:
9 | runs-on: ubuntu-latest
10 |
11 | steps:
12 | - uses: actions/checkout@v2
13 |
14 | - name: Update Gradle Wrapper
15 | uses: gradle-update/update-gradle-wrapper-action@v1
16 | with:
17 | repo-token: ${{ secrets.GITHUB_TOKEN }}
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/test/java/to/dev/dev_android/view/main/view/CustomWebViewClientTest.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.view.main.view
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | class CustomWebViewClientTest {
8 |
9 | @Test
10 | fun onPageFinished() {
11 | }
12 |
13 | @Test
14 | fun shouldOverrideUrlLoading() {
15 | }
16 |
17 | @Test
18 | fun getContext() {
19 | }
20 |
21 | @Test
22 | fun getBinding() {
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/test/java/to/dev/dev_android/view/main/view/MainActivityTest.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.view.main.view
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | class MainActivityTest {
8 |
9 | @Test
10 | fun `2 plus 2 equals 4`() {
11 | assertEquals(2+2, 4)
12 | }
13 |
14 | @Test
15 | fun onCreate() {
16 |
17 |
18 | }
19 |
20 | @Test
21 | fun onNewIntent() {
22 | }
23 |
24 | @Test
25 | fun onBackPressed() {
26 | }
27 | }
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## What type of PR is this? (check all applicable)
4 |
5 | - [ ] Refactor
6 | - [ ] Feature
7 | - [ ] Bug Fix
8 | - [ ] Documentation Update
9 |
10 | ## Description
11 |
12 | ## Related Tickets & Documents
13 |
14 | ## Screenshots/Recordings (if there are UI changes)
15 |
16 | ## [optional] What gif best describes this PR or how it makes you feel?
17 |
18 | 
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/activities/StarterApplication.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.activities
2 |
3 | import androidx.multidex.MultiDexApplication
4 | import org.greenrobot.eventbus.EventBus
5 | import to.dev.dev_android.webclients.EventBusClientIndex
6 |
7 |
8 | class StarterApplication : MultiDexApplication() {
9 |
10 | override fun onCreate() {
11 | super.onCreate()
12 | EventBus.builder().addIndex(EventBusClientIndex()).build()
13 | EventBus.builder().addIndex(EventBusClientIndex()).installDefaultEventBus()
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/activities/BaseActivity.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.activities
2 |
3 | import android.os.Bundle
4 | import androidx.annotation.LayoutRes
5 | import androidx.appcompat.app.AppCompatActivity
6 | import androidx.databinding.DataBindingUtil
7 | import androidx.databinding.ViewDataBinding
8 |
9 | abstract class BaseActivity : AppCompatActivity() {
10 |
11 | lateinit var binding: B
12 |
13 | @LayoutRes
14 | protected abstract fun layout(): Int
15 |
16 | override fun onCreate(savedInstanceState: Bundle?) {
17 | super.onCreate(savedInstanceState)
18 | binding = DataBindingUtil.setContentView(this, layout())
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | gradlePluginPortal()
4 | mavenLocal()
5 | }
6 | }
7 |
8 |
9 | plugins {
10 | // See https://jmfayard.github.io/refreshVersions
11 | id("de.fayard.refreshVersions") version "0.10.0"
12 |
13 | // See https://dev.to/jmfayard/the-one-gradle-trick-that-supersedes-all-the-others-5bpg
14 | id("com.gradle.enterprise").version("3.1.1")
15 | }
16 |
17 | gradleEnterprise {
18 | buildScan {
19 | termsOfServiceUrl = "https://gradle.com/terms-of-service"
20 | termsOfServiceAgree = "yes"
21 | publishOnFailure()
22 | }
23 | }
24 |
25 | refreshVersions {
26 | enableBuildSrcLibs()
27 | }
28 |
29 | include(":app")
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 |
12 |
13 | **Describe the solution you'd like**
14 |
15 |
16 | **Describe alternatives you've considered**
17 |
18 |
19 | **Additional context**
20 |
21 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/to/dev/dev_android/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android
2 |
3 | import androidx.test.InstrumentationRegistry
4 | import androidx.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("to.dev.dev_android", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 |
12 |
13 | **To Reproduce**
14 |
15 |
16 |
17 |
18 |
19 |
20 | **Expected behavior**
21 |
22 |
23 | **Screenshots**
24 |
25 |
26 | **Smartphone (please complete the following information):**
27 | - Device:
28 | - OS:
29 | - Version:
30 |
31 | **Additional context**
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DEV Community
3 | Splash
4 | Podcast Player
5 | Find DEV in the Forem app
6 | Get Forem for android in the Play Store. Your DEV profile info will be carried over so you can pick up where you left off!
7 | Open Forem app now. Your DEV profile info will be carried over so you can pick up where you left off!
8 | Download Forem App
9 | Open Forem App
10 | Show Forem app promotion dialog
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/util/network/NetworkUtils.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.util.network
2 |
3 | import kotlinx.coroutines.Dispatchers
4 | import kotlinx.coroutines.withContext
5 | import to.dev.dev_android.BuildConfig
6 | import java.io.IOException
7 | import java.net.InetSocketAddress
8 | import java.net.Socket
9 |
10 | typealias NetworkStatusCallback = (isOnline: Boolean) -> Unit
11 |
12 | object NetworkUtils {
13 | suspend fun isOnline(): Boolean = withContext(Dispatchers.IO) {
14 | try {
15 | val timeout = 1500
16 | val address = InetSocketAddress(BuildConfig.baseHostname, 80)
17 |
18 | Socket().apply {
19 | connect(address, timeout)
20 | close()
21 | }
22 |
23 | true
24 | } catch (e: IOException) {
25 | false
26 | }
27 | }
28 |
29 | suspend fun isOffline(): Boolean = !isOnline()
30 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_video_player.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
13 |
14 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.github/workflows/runOnGitHub.yml:
--------------------------------------------------------------------------------
1 | # .github/workflows/runOnGitHub.yml
2 | # GitHub Actions documentation
3 | # => https://docs.github.com/en/actions
4 | name: runOnGitHub
5 |
6 | # Controls when the action will run. Triggers the workflow on push or pull request
7 | # events but only for the master branch
8 | on: push
9 | jobs:
10 | gradle:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v1
14 | - name: Copy fake google-services.json
15 | run: cp -f .github/fake-google-services.json app/google-services.json
16 | - uses: actions/setup-java@v1
17 | with:
18 | java-version: 8
19 |
20 | # Execute Gradle commands in GitHub Actions workflows
21 | # => https://github.com/marketplace/actions/gradle-command
22 | - uses: eskatos/gradle-command-action@v1
23 | with:
24 | arguments: runOnGitHub
25 | wrapper-cache-enabled: true
26 | dependencies-cache-enabled: true
27 | configuration-cache-enabled: true
28 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/util/network/NetworkWatcher.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.util.network
2 |
3 | import android.content.BroadcastReceiver
4 | import android.content.Context
5 | import android.content.Intent
6 | import android.content.IntentFilter
7 | import kotlinx.coroutines.CoroutineScope
8 | import kotlinx.coroutines.async
9 | import kotlinx.coroutines.launch
10 | import org.greenrobot.eventbus.EventBus
11 | import to.dev.dev_android.events.NetworkStatusEvent
12 |
13 | class NetworkWatcher(val coroutineScope: CoroutineScope) : BroadcastReceiver() {
14 | companion object {
15 | val intentFilter = IntentFilter().apply {
16 | addAction("android.net.conn.CONNECTIVITY_CHANGE")
17 | }
18 | }
19 |
20 | override fun onReceive(context: Context?, intent: Intent?) {
21 | coroutineScope.launch {
22 | if (async { NetworkUtils.isOnline() }.await()) {
23 | EventBus.getDefault().post(NetworkStatusEvent(NetworkStatus.BACK_ONLINE))
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_compass.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/webclients/CustomWebChromeClient.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.webclients
2 |
3 | import android.net.Uri
4 | import android.webkit.ValueCallback
5 | import android.webkit.WebChromeClient
6 | import android.webkit.WebView
7 |
8 |
9 | class CustomWebChromeClient(
10 | private val baseURL: String,
11 | private val listener: CustomListener
12 | ) : WebChromeClient() {
13 |
14 | override fun onShowFileChooser(
15 | webView: WebView?,
16 | filePathCallback: ValueCallback>?,
17 | fileChooserParams: FileChooserParams?
18 | ): Boolean {
19 | listener.launchGallery(filePathCallback)
20 | return true
21 | }
22 |
23 | override fun onProgressChanged(view: WebView, newProgress: Int) {
24 | super.onProgressChanged(view, newProgress)
25 | if (newProgress == 100 && view.url == baseURL) {
26 | //view.clearHistory()
27 | }
28 | }
29 |
30 | interface CustomListener {
31 | fun launchGallery(filePathCallback: ValueCallback>?)
32 | }
33 | }
--------------------------------------------------------------------------------
/.github/fake-google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "1092521184945",
4 | "firebase_url": "https://dev-personal-XXX.firebaseio.com",
5 | "project_id": "dev-personal-XXX",
6 | "storage_bucket": "dev-personal-XXX.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:1092521184945:android:af137629aab59de5af1c90",
12 | "android_client_info": {
13 | "package_name": "to.dev.dev_android.debug"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "XX.apps.googleusercontent.com",
19 | "client_type": 3
20 | }
21 | ],
22 | "api_key": [
23 | {
24 | "current_key": "XXX"
25 | }
26 | ],
27 | "services": {
28 | "appinvite_service": {
29 | "other_platform_oauth_client": [
30 | {
31 | "client_id": "XXX.apps.googleusercontent.com",
32 | "client_type": 3
33 | }
34 | ]
35 | }
36 | }
37 | }
38 | ],
39 | "configuration_version": "1"
40 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_news.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/fastlane/Fastfile:
--------------------------------------------------------------------------------
1 | # This file contains the fastlane.tools configuration
2 | # You can find the documentation at https://docs.fastlane.tools
3 | #
4 | # For a list of all available actions, check out
5 | #
6 | # https://docs.fastlane.tools/actions
7 | #
8 | # For a list of all available plugins, check out
9 | #
10 | # https://docs.fastlane.tools/plugins/available-plugins
11 | #
12 |
13 | # Uncomment the line if you want fastlane to automatically update itself
14 | # update_fastlane
15 |
16 | default_platform(:android)
17 |
18 | platform :android do
19 | desc "Runs all the tests"
20 | lane :test do
21 | gradle(task: "test")
22 | end
23 |
24 | desc "Submit a new Beta Build to Google Play"
25 | lane :beta do
26 | # gradle(task: "clean")
27 | gradle(task: 'bundle', build_type: 'Release')
28 | upload_to_play_store(
29 | track: "beta",
30 | release_status: "draft",
31 | skip_upload_apk: true,
32 | skip_upload_changelogs: true,
33 | skip_upload_images: true,
34 | skip_upload_metadata: true,
35 | skip_upload_screenshots: true,
36 | )
37 | # slack(message: 'Successfully distributed a new beta build')
38 | end
39 |
40 | desc "Deploy a new version to the Google Play"
41 | lane :deploy do
42 | gradle(task: "clean assembleRelease")
43 | upload_to_play_store
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/versions.properties:
--------------------------------------------------------------------------------
1 | #### Dependencies and Plugin versions with their available updates.
2 | #### Generated by `./gradlew refreshVersions` version 0.10.0
3 | ####
4 | #### Don't manually edit or split the comments that start with four hashtags (####),
5 | #### they will be overwritten by refreshVersions.
6 | ####
7 | #### suppress inspection "SpellCheckingInspection" for whole file
8 | #### suppress inspection "UnusedProperty" for whole file
9 |
10 |
11 |
12 | version.androidx.appcompat=1.1.0
13 |
14 | version.androidx.browser=1.0.0
15 |
16 | version.androidx.constraintlayout=1.1.3
17 |
18 | version.androidx.databinding=3.5.0
19 |
20 | version.androidx.lifecycle=2.1.0
21 |
22 | version.androidx.multidex=2.0.1
23 |
24 | version.androidx.test=1.2.0
25 |
26 | version.androidx.test.espresso=3.2.0
27 |
28 | version.com.google.android.exoplayer..exoplayer-core=2.11.4
29 |
30 | version.com.google.android.exoplayer..exoplayer-hls=2.11.4
31 |
32 | version.com.google.android.exoplayer..exoplayer-ui=2.11.4
33 |
34 | version.com.google.android.exoplayer..extension-mediasession=2.11.4
35 |
36 | version.com.google.code.gson..gson=2.8.6
37 |
38 | version.com.pusher..push-notifications-android=1.6.2
39 |
40 | version.firebase-messaging=18.0.0
41 |
42 | version.junit.junit=4.13
43 |
44 | version.kotlin=1.3.71
45 |
46 | version.kotlinx.coroutines=1.3.7
47 |
48 | version.org.greenrobot..eventbus=3.2.0
49 |
50 | version.org.greenrobot..eventbus-annotation-processor=3.2.0
51 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
6 |
8 |
11 |
14 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
19 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## dev.to configurations
2 | chrome.baseUrl=https://dev.to/
3 | chrome.baseHostname=dev.to
4 | chrome.userAgent=DEV-Native-android
5 | pusher.instanceId=cdaf9857-fad0-4bfb-b360-64c1b2693ef3
6 |
7 | # Android release configurations
8 | android.targetSdkVersion=29
9 | android.compileSdkVersion=29
10 | android.minSdkVersion=21
11 | android.applicationId=to.dev.dev_android
12 | android.versionCode=14
13 | android.versionName=1.5.1
14 |
15 | # Keep in sync with buildSrc/build.gradle.kts
16 |
17 |
18 | # Project-wide Gradle settings.
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 | # For more details on how to configure your build environment visit
23 | # http://www.gradle.org/docs/current/userguide/build_environment.html
24 | # Specifies the JVM arguments used for the daemon process.
25 | # The setting is particularly useful for tweaking memory settings.
26 | org.gradle.jvmargs=-Xmx1536m
27 | # When configured, Gradle will run in incubating parallel mode.
28 | # This option should only be used with decoupled projects. More details, visit
29 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
30 | # org.gradle.parallel=true
31 | # Kotlin code style for this project: "official" or "obsolete":
32 | kotlin.code.style=official
33 | kotlin.setJvmTargetFromAndroidCompileOptions = true
34 | android.useAndroidX=true
35 | android.enableJetifier=true
36 | studio.projectview=true
37 | # Dependencies and Plugin versions with their available updates
38 | # Generated by $ ./gradlew refreshVersions
39 | # You can edit the rest of the file, it will be kept intact
40 | # See https://github.com/jmfayard/buildSrcVersions/issues/77
41 | plugin.com.github.ben-manes.versions=0.25.0
42 | plugin.io.gitlab.arturbosch.detekt=1.1.1
43 | # # available=1.6.0
44 | plugin.de.fayard.buildSrcVersions=0.7.0
45 | version.androidx.databinding=3.6.0
46 | version.org.jetbrains.kotlin=1.3.71
47 | version.androidx.lifecycle=2.1.0
48 | version.com.android.tools.build..gradle=3.6.0
49 | version.androidx.test..runner=1.2.0
50 | version.gradleLatestVersion=6.2.1
51 | version.constraintlayout=1.1.3
52 | version.espresso-core=3.2.0
53 | version.lint-gradle=26.5.3
54 | version.appcompat=1.1.0
55 | version.browser=1.0.0
56 | version.aapt2=3.5.3-5435860
57 | version.junit=4.13
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/media/PodcastPlayerNotificationManager.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.media
2 |
3 | import android.content.Context
4 | import androidx.annotation.IntegerRes
5 | import com.google.android.exoplayer2.Player
6 | import com.google.android.exoplayer2.ui.PlayerNotificationManager
7 | import com.google.android.exoplayer2.util.NotificationUtil
8 | import java.util.*
9 |
10 | /*
11 | * This subclass of PlayerNotificationManager customizes the controls available in the
12 | * notification by overriding the getActions method.
13 | */
14 | class PodcastPlayerNotificationManager(
15 | context: Context,
16 | channelId: String,
17 | notificationId: Int,
18 | mediaDescriptionAdapter: MediaDescriptionAdapter,
19 | playerNotificationManager: NotificationListener
20 | ): PlayerNotificationManager(
21 | context,
22 | channelId,
23 | notificationId,
24 | mediaDescriptionAdapter,
25 | playerNotificationManager) {
26 |
27 | companion object {
28 | fun createWithNotificationChannel(
29 | context: Context,
30 | channelId: String,
31 | channelName: Int,
32 | channelDescription: Int,
33 | notificationId: Int,
34 | mediaDescriptionAdapter: MediaDescriptionAdapter,
35 | playerNotificationManager: NotificationListener): PodcastPlayerNotificationManager {
36 |
37 | NotificationUtil.createNotificationChannel(
38 | context, channelId, channelName, channelDescription, NotificationUtil.IMPORTANCE_LOW
39 | )
40 | return PodcastPlayerNotificationManager(
41 | context, channelId, notificationId, mediaDescriptionAdapter, playerNotificationManager
42 | )
43 | }
44 | }
45 |
46 | override fun getActions(player: Player): List {
47 | var stringActions: List = ArrayList()
48 | stringActions += ACTION_REWIND
49 | stringActions += if (shouldShowPauseButton(player)) {
50 | ACTION_PAUSE
51 | } else {
52 | ACTION_PLAY
53 | }
54 | stringActions += ACTION_FAST_FORWARD
55 | return stringActions
56 | }
57 |
58 | private fun shouldShowPauseButton(player: Player): Boolean {
59 | val state = player.playbackState
60 | return state != Player.STATE_ENDED && state != Player.STATE_IDLE && player.playWhenReady
61 | }
62 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 | *.aab
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | /buildSrc/.gradle
20 |
21 | # Build files
22 | /build
23 | /buildSrc/build
24 | /app/build
25 |
26 | # Local configuration file (sdk path, etc)
27 | local.properties
28 |
29 | # Proguard folder generated by Eclipse
30 | proguard/
31 |
32 | # Log Files
33 | *.log
34 |
35 | # Android Studio Navigation editor temp files
36 | .navigation/
37 |
38 | # Android Studio captures folder
39 | captures/
40 |
41 | # IntelliJ
42 | *.iml
43 | .idea/**/workspace.xml
44 | .idea/**/tasks.xml
45 | .idea/**/usage.statistics.xml
46 | .idea/**/contentModel.xml
47 | .idea/**/gradle.xml
48 | .idea/**/misc.xml
49 | .idea/**/dictionaries
50 | .idea/**/shelf
51 | .idea/assetWizardSettings.xml
52 | .idea/libraries
53 | .idea/caches
54 | .idea/caches/build_file_checksums.ser
55 |
56 | # Sensitive or high-churn files
57 | .idea/**/dataSources/
58 | .idea/**/dataSources.ids
59 | .idea/**/dataSources.local.xml
60 | .idea/**/sqlDataSources.xml
61 | .idea/**/dynamic.xml
62 | .idea/**/uiDesigner.xml
63 | .idea/**/dbnavigator.xml
64 |
65 | # Gradle and Maven with auto-import
66 | .idea/modules.xml
67 | .idea/jarRepositories.xml
68 | .idea/artifacts
69 | .idea/compiler.xml
70 | .idea/*.iml
71 | .idea/modules
72 | *.iml
73 | *.ipr
74 | *.iws
75 |
76 | # Keystore files
77 | # Uncomment the following lines if you do not want to check your keystore files in.
78 | *.jks
79 | *.keystore
80 | keystore.properties
81 |
82 | # External native build folder generated in Android Studio 2.2 and later
83 | .externalNativeBuild
84 |
85 | # Google Services (e.g. APIs or Firebase)
86 | google-services.json
87 | app/**/google-services.json
88 |
89 | # Freeline
90 | freeline.py
91 | freeline/
92 | freeline_project_description.json
93 |
94 | # fastlane
95 | fastlane/report.xml
96 | fastlane/Preview.html
97 | fastlane/screenshots
98 | fastlane/test_output
99 | fastlane/readme.md
100 |
101 | # Version control
102 | vcs.xml
103 |
104 | # lint
105 | lint/intermediates/
106 | lint/generated/
107 | lint/outputs/
108 | lint/tmp/
109 | lint/reports/
110 |
111 | # Detekt Reports
112 | reports/
113 |
114 | # Firebase config
115 | app/google-services.json
116 |
117 | # Google's service account user
118 | google-service-account-user.json
119 |
120 | # Fastlane
121 | fastlane/README.md
122 | fastlane/metadata/
123 | fastlane/*.xml
124 |
125 | # Extra
126 | *.DS_Store
127 |
128 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/exo_player_control_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
21 |
22 |
24 |
25 |
27 |
28 |
30 |
31 |
32 |
33 |
39 |
40 |
49 |
50 |
54 |
55 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import java.util.Properties
2 | import java.io.FileInputStream
3 |
4 | plugins {
5 | id("com.android.application")
6 | kotlin("android")
7 | kotlin("android.extensions")
8 | kotlin("kapt")
9 | }
10 |
11 | val keystorePropertiesFile = rootProject.file("keystore.properties")
12 | val keystoreProperties = Properties()
13 | if (keystorePropertiesFile.exists()) {
14 | keystoreProperties.load(FileInputStream(keystorePropertiesFile))
15 | }
16 |
17 | android {
18 | configureAndroid(this)
19 | configureBuildConfig(this)
20 | signingConfigs {
21 | create("release") {
22 | keystoreProperties["storeFile"]?.let {
23 | keyAlias = keystoreProperties["keyAlias"].toString()
24 | keyPassword = keystoreProperties["keyPassword"].toString()
25 | storeFile = file(it)
26 | storePassword = keystoreProperties["storePassword"].toString()
27 | }
28 | }
29 | }
30 |
31 | buildTypes {
32 | getByName("release") {
33 | isMinifyEnabled = true
34 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
35 | signingConfig = signingConfigs.getByName("release")
36 | }
37 | getByName("debug") {
38 | applicationIdSuffix = ".debug"
39 | isDebuggable = true
40 | }
41 | }
42 | dataBinding {
43 | isEnabled = true
44 | }
45 | }
46 |
47 | dependencies {
48 | implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
49 |
50 | implementation(Libs.multidex)
51 |
52 | implementation(Libs.kotlin_stdlib_jdk8)
53 | implementation(Libs.browser)
54 |
55 | implementation(Libs.kotlinx_coroutines_core)
56 | implementation(Libs.kotlinx_coroutines_android)
57 |
58 | implementation(Libs.eventbus)
59 | kapt(Libs.eventbus_annotation_processor)
60 |
61 | implementation(Libs.exoplayer_core)
62 | implementation(Libs.exoplayer_ui)
63 | implementation(Libs.exoplayer_hls)
64 | implementation(Libs.extension_mediasession)
65 | implementation(Libs.firebase_messaging)
66 | implementation(Libs.push_notifications_android)
67 | implementation(Libs.gson)
68 |
69 | api(Libs.appcompat)
70 | api(Libs.constraintlayout)
71 | api(Libs.lifecycle_extensions)
72 | api(Libs.lifecycle_viewmodel)
73 |
74 | testImplementation(Libs.junit)
75 | androidTestImplementation(Libs.androidx_test_runner)
76 | androidTestImplementation(Libs.espresso_core)
77 | }
78 |
79 | kapt {
80 |
81 | arguments {
82 | arg("eventBusIndex", "to.dev.dev_android.webclients.EventBusClientIndex")
83 | }
84 | }
85 |
86 | apply(plugin = "com.google.gms.google-services")
87 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/activities/VideoPlayerActivity.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.activities
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.net.Uri
6 | import android.os.Bundle
7 | import androidx.annotation.MainThread
8 | import com.google.android.exoplayer2.SimpleExoPlayer
9 | import com.google.android.exoplayer2.source.hls.HlsMediaSource
10 | import com.google.android.exoplayer2.upstream.DataSource
11 | import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory
12 | import org.greenrobot.eventbus.EventBus
13 | import to.dev.dev_android.BuildConfig
14 | import to.dev.dev_android.R
15 | import to.dev.dev_android.databinding.ActivityVideoPlayerBinding
16 | import to.dev.dev_android.events.VideoPlayerPauseEvent
17 | import to.dev.dev_android.events.VideoPlayerTickEvent
18 | import to.dev.dev_android.webclients.CustomWebViewClient
19 | import java.util.*
20 |
21 | class VideoPlayerActivity : BaseActivity() {
22 |
23 | private var player: SimpleExoPlayer? = null
24 | private val timer = Timer()
25 |
26 | override fun layout(): Int {
27 | return R.layout.activity_video_player
28 | }
29 |
30 | override fun onCreate(savedInstanceState: Bundle?) {
31 | super.onCreate(savedInstanceState)
32 |
33 | val videoUrl = intent.getStringExtra(argVideoUrl)
34 | val videoTime = intent.getStringExtra(argVideoTime)
35 |
36 | val streamUri= Uri.parse(videoUrl)
37 | val dataSourceFactory: DataSource.Factory = DefaultHttpDataSourceFactory(BuildConfig.userAgent)
38 | val mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(streamUri)
39 |
40 | player = SimpleExoPlayer.Builder(this).build()
41 | binding.playerView.player = player
42 | player?.prepare(mediaSource)
43 | player?.seekTo(videoTime.toLong() * 1000)
44 | player?.playWhenReady = true
45 |
46 | val timeUpdateTask = object: TimerTask() {
47 | override fun run() {
48 | timeUpdate()
49 | }
50 | }
51 | timer.schedule(timeUpdateTask, 0, 1000)
52 | }
53 |
54 | override fun onDestroy() {
55 | player?.playWhenReady = false
56 | timer.cancel()
57 | EventBus.getDefault().post(VideoPlayerPauseEvent())
58 | super.onDestroy()
59 | }
60 |
61 | fun timeUpdate() {
62 | val milliseconds = (player?.currentPosition ?: 0)
63 | val currentTime = (milliseconds / 1000).toString()
64 | EventBus.getDefault().post(VideoPlayerTickEvent(currentTime))
65 | }
66 |
67 | companion object {
68 | @MainThread
69 | fun newIntent(
70 | context: Context,
71 | url: String,
72 | time: String
73 | ) = Intent(context, VideoPlayerActivity::class.java).apply {
74 | putExtra(argVideoUrl, url)
75 | putExtra(argVideoTime, time)
76 | }
77 |
78 | const val argVideoUrl = "ARG_VIDEO_URL"
79 | const val argVideoTime = "ARG_VIDEO_TIME"
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
11 |
19 |
20 |
26 |
27 |
37 |
38 |
50 |
51 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at yo@dev.to. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DEV Android 💝
2 |
3 |
4 |
5 | This is the official repository for the [dev.to](https://dev.to/)'s Android app.
6 |
7 |
8 |
9 |
10 | ## Design ethos
11 |
12 | DEV Android is an [WebView](https://developer.android.com/guide/webapps/webview) based application. This application is inspired by [Basecamp's approach](https://m.signalvnoise.com/basecamp-3-for-ios-hybrid-architecture-afc071589c25). We will grow to include more native code over time.
13 |
14 | By leveraging webviews as much as possible, we can smoothly sync up with our web dev work. And where it makes sense, we can re-implement certain things fully native, or build entirely native features. Life's a journey, not a destination.
15 |
16 | ## Contributions
17 |
18 | We expect contributors to abide by our underlying [code of conduct](./CODE_OF_CONDUCT.md). All conversations and discussions on GitHub (issues, pull requests) and across dev.to must be respectful and harassment-free.
19 |
20 | ### System Requirements
21 |
22 | You will need to have Android Studio 3.5 or up installed.
23 |
24 | ### Usage
25 |
26 | ```bash
27 | $ ./gradlew tasks --group=custom
28 |
29 | ------------------------------------------------------------
30 | Tasks runnable from root project
31 | ------------------------------------------------------------
32 |
33 | Custom tasks
34 | ------------
35 | androidTest - Run android instrumentation tests
36 | hello - Hello World task - useful to solve build problems
37 | install - Build and install the app
38 | test - Run the unit tests
39 |
40 | To see all tasks and more detail, run gradlew tasks --all
41 |
42 | To see more detail about a task, run gradlew help --task
43 |
44 | ```
45 |
46 | ### Push Notifications
47 |
48 | For Push Notification delivery we use [Pusher Beams](https://pusher.com/beams). In order to get the app running locally you'll need a `google-services.json` configuration file from Firebase, otherwise you'll encounter the following error: `File google-services.json is missing. The Google Services Plugin cannot function without it.`
49 |
50 | You can [sign up or sign in on Firebase](https://firebase.google.com/) account for free in order to get the app working locally. Steps 1-4 under **Firebase for Android Push Notifications** in our [official docs](https://docs.dev.to/backend/pusher/#mobile-push-notifications) show how to set this up in more detail. Drop the resulting `google-services.json` file in the `app` folder and you'll be good to go.
51 |
52 | ### How to contribute
53 |
54 | 1. Fork the project & clone locally.
55 | 1. Create a branch, naming it either a feature or bug: `git checkout -b feature/that-new-feature` or `bug/fixing-that-bug`
56 | 1. Code and commit your changes. Bonus points if you write a [good commit message](https://chris.beams.io/posts/git-commit/): `git commit -m 'Add some feature'`
57 | 1. Push to the branch: `git push origin feature/that-new-feature`
58 | 1. Create a pull request for your branch 🎉
59 |
60 | ## License
61 |
62 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Please see the [LICENSE](./LICENSE) file in our repository for the full text.
63 |
64 | Like many open source projects, we require that contributors provide us with a Contributor License Agreement (CLA). By submitting code to the DEV project, you are granting us a right to use that code under the terms of the CLA.
65 |
66 | Our version of the CLA was adapted from the Microsoft Contributor License Agreement, which they generously made available to the public domain under Creative Commons CC0 1.0 Universal.
67 |
68 | Any questions, please refer to our [license FAQ](https://docs.dev.to/licensing/) doc or email yo@dev.to
69 |
70 |
71 |
72 |
73 |
78 |
79 | Happy Coding ❤️
80 |
81 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | xmlns:android
30 |
31 | ^$
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | xmlns:.*
41 |
42 | ^$
43 |
44 |
45 | BY_NAME
46 |
47 |
48 |
49 |
50 |
51 |
52 | .*:id
53 |
54 | http://schemas.android.com/apk/res/android
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | .*:name
64 |
65 | http://schemas.android.com/apk/res/android
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | name
75 |
76 | ^$
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | style
86 |
87 | ^$
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | .*
97 |
98 | ^$
99 |
100 |
101 | BY_NAME
102 |
103 |
104 |
105 |
106 |
107 |
108 | .*
109 |
110 | http://schemas.android.com/apk/res/android
111 |
112 |
113 | ANDROID_ATTRIBUTE_ORDER
114 |
115 |
116 |
117 |
118 |
119 |
120 | .*
121 |
122 | .*
123 |
124 |
125 | BY_NAME
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/forem_app_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
20 |
21 |
37 |
38 |
54 |
55 |
67 |
68 |
76 |
77 |
85 |
86 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/activities/ForemAppDialog.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.activities
2 |
3 | import android.app.Activity
4 | import android.content.ActivityNotFoundException
5 | import android.content.Intent
6 | import android.net.Uri
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.constraintlayout.widget.ConstraintLayout
12 | import androidx.fragment.app.DialogFragment
13 | import android.content.pm.PackageManager
14 | import android.widget.ImageView
15 | import android.widget.TextView
16 | import androidx.core.content.ContextCompat
17 | import to.dev.dev_android.R
18 |
19 | class ForemAppDialog : DialogFragment() {
20 |
21 | companion object {
22 | const val PACKAGE_NAME = "com.forem.android"
23 | private const val FOREM_URL = "ForemAppDialog.url"
24 |
25 | fun newInstance(url: String): ForemAppDialog {
26 | val foremAppDialog = ForemAppDialog()
27 | val args = Bundle()
28 | args.putString(FOREM_URL, url)
29 | foremAppDialog.arguments = args
30 | return foremAppDialog
31 | }
32 |
33 | fun isForemAppAlreadyInstalled(activity: Activity?): Boolean {
34 | return try {
35 | activity?.packageManager?.getPackageInfo(PACKAGE_NAME, 0)
36 | true
37 | } catch (e: PackageManager.NameNotFoundException) {
38 | false
39 | }
40 | }
41 |
42 | fun openForemApp(activity: Activity?, url: String?) {
43 | val packageManager: PackageManager? = activity?.packageManager
44 | val app = packageManager?.getLaunchIntentForPackage(PACKAGE_NAME)
45 | if (!url.isNullOrEmpty()) {
46 | app?.putExtra(Intent.EXTRA_TEXT, url)
47 | }
48 | activity?.startActivity(app)
49 | }
50 | }
51 |
52 | lateinit var url: String
53 |
54 | override fun onStart() {
55 | super.onStart()
56 | val width = resources.displayMetrics.widthPixels
57 | dialog!!.window?.setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT)
58 | }
59 |
60 | override fun onCreateView(
61 | inflater: LayoutInflater,
62 | container: ViewGroup?,
63 | savedInstanceState: Bundle?
64 | ): View? {
65 | val args = arguments
66 | url = args?.getString(FOREM_URL) ?: ""
67 |
68 | val view = inflater.inflate(R.layout.forem_app_dialog, container, false)
69 | if (dialog != null && dialog!!.window != null) {
70 | dialog!!.window?.setBackgroundDrawableResource(R.drawable.forem_dialog_fragment_background)
71 | }
72 | val downloadInstallForemAppTextView =
73 | view.findViewById(R.id.download_install_forem_app_text_view)
74 | val downloadOpenForemAppImageView =
75 | view.findViewById(R.id.download_open_forem_image_view)
76 | val descriptionTextView =
77 | view.findViewById(R.id.forem_app_dialog_description_text_view)
78 |
79 | if (isForemAppAlreadyInstalled(activity)) {
80 | downloadInstallForemAppTextView.text = getString(R.string.open_forem_app)
81 | downloadOpenForemAppImageView.setImageDrawable(
82 | ContextCompat.getDrawable(
83 | this.requireContext(),
84 | R.drawable.ic_compass
85 | )
86 | )
87 | descriptionTextView.text = getString(R.string.forem_app_dialog_description_if_installed)
88 | } else {
89 | downloadInstallForemAppTextView.text = getString(R.string.download_forem_app)
90 | downloadOpenForemAppImageView.setImageDrawable(
91 | ContextCompat.getDrawable(
92 | this.requireContext(),
93 | R.drawable.ic_baseline_arrow_downward_24
94 | )
95 | )
96 | descriptionTextView.text = getString(R.string.forem_app_dialog_description)
97 | }
98 |
99 | val downloadLayout = view.findViewById(R.id.download_forem_app_layout)
100 |
101 | downloadLayout.setOnClickListener {
102 | openForemAppLink()
103 | }
104 | return view
105 | }
106 |
107 | private fun openForemAppLink() {
108 | if (isForemAppAlreadyInstalled(activity)) {
109 | openForemApp(activity, url)
110 | } else {
111 | try {
112 | // Opens Forem app in Play Store, if Play Store app is available.
113 | activity?.startActivity(
114 | Intent(
115 | Intent.ACTION_VIEW,
116 | Uri.parse("market://details?id=$PACKAGE_NAME")
117 | )
118 | )
119 | } catch (e: ActivityNotFoundException) {
120 | // Opens Forem app on Play Store in browser.
121 | activity?.startActivity(
122 | Intent(
123 | Intent.ACTION_VIEW,
124 | Uri.parse("https://play.google.com/store/apps/details?id=$PACKAGE_NAME")
125 | )
126 | )
127 | }
128 | }
129 | this.dismiss()
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | CFPropertyList (3.0.2)
5 | addressable (2.8.0)
6 | public_suffix (>= 2.0.2, < 5.0)
7 | atomos (0.1.3)
8 | aws-eventstream (1.1.0)
9 | aws-partitions (1.391.0)
10 | aws-sdk-core (3.109.2)
11 | aws-eventstream (~> 1, >= 1.0.2)
12 | aws-partitions (~> 1, >= 1.239.0)
13 | aws-sigv4 (~> 1.1)
14 | jmespath (~> 1.0)
15 | aws-sdk-kms (1.39.0)
16 | aws-sdk-core (~> 3, >= 3.109.0)
17 | aws-sigv4 (~> 1.1)
18 | aws-sdk-s3 (1.84.1)
19 | aws-sdk-core (~> 3, >= 3.109.0)
20 | aws-sdk-kms (~> 1)
21 | aws-sigv4 (~> 1.1)
22 | aws-sigv4 (1.2.2)
23 | aws-eventstream (~> 1, >= 1.0.2)
24 | babosa (1.0.4)
25 | claide (1.0.3)
26 | colored (1.2)
27 | colored2 (3.1.2)
28 | commander-fastlane (4.4.6)
29 | highline (~> 1.7.2)
30 | declarative (0.0.20)
31 | declarative-option (0.1.0)
32 | digest-crc (0.6.1)
33 | rake (~> 13.0)
34 | domain_name (0.5.20190701)
35 | unf (>= 0.0.5, < 1.0.0)
36 | dotenv (2.7.6)
37 | emoji_regex (3.2.1)
38 | excon (0.78.0)
39 | faraday (1.1.0)
40 | multipart-post (>= 1.2, < 3)
41 | ruby2_keywords
42 | faraday-cookie_jar (0.0.7)
43 | faraday (>= 0.8.0)
44 | http-cookie (~> 1.0.0)
45 | faraday_middleware (1.0.0)
46 | faraday (~> 1.0)
47 | fastimage (2.2.0)
48 | fastlane (2.166.0)
49 | CFPropertyList (>= 2.3, < 4.0.0)
50 | addressable (>= 2.3, < 3.0.0)
51 | aws-sdk-s3 (~> 1.0)
52 | babosa (>= 1.0.3, < 2.0.0)
53 | bundler (>= 1.12.0, < 3.0.0)
54 | colored
55 | commander-fastlane (>= 4.4.6, < 5.0.0)
56 | dotenv (>= 2.1.1, < 3.0.0)
57 | emoji_regex (>= 0.1, < 4.0)
58 | excon (>= 0.71.0, < 1.0.0)
59 | faraday (~> 1.0)
60 | faraday-cookie_jar (~> 0.0.6)
61 | faraday_middleware (~> 1.0)
62 | fastimage (>= 2.1.0, < 3.0.0)
63 | gh_inspector (>= 1.1.2, < 2.0.0)
64 | google-api-client (>= 0.37.0, < 0.39.0)
65 | google-cloud-storage (>= 1.15.0, < 2.0.0)
66 | highline (>= 1.7.2, < 2.0.0)
67 | json (< 3.0.0)
68 | jwt (>= 2.1.0, < 3)
69 | mini_magick (>= 4.9.4, < 5.0.0)
70 | multipart-post (~> 2.0.0)
71 | plist (>= 3.1.0, < 4.0.0)
72 | rubyzip (>= 2.0.0, < 3.0.0)
73 | security (= 0.1.3)
74 | simctl (~> 1.6.3)
75 | slack-notifier (>= 2.0.0, < 3.0.0)
76 | terminal-notifier (>= 2.0.0, < 3.0.0)
77 | terminal-table (>= 1.4.5, < 2.0.0)
78 | tty-screen (>= 0.6.3, < 1.0.0)
79 | tty-spinner (>= 0.8.0, < 1.0.0)
80 | word_wrap (~> 1.0.0)
81 | xcodeproj (>= 1.13.0, < 2.0.0)
82 | xcpretty (~> 0.3.0)
83 | xcpretty-travis-formatter (>= 0.0.3)
84 | gh_inspector (1.1.3)
85 | google-api-client (0.38.0)
86 | addressable (~> 2.5, >= 2.5.1)
87 | googleauth (~> 0.9)
88 | httpclient (>= 2.8.1, < 3.0)
89 | mini_mime (~> 1.0)
90 | representable (~> 3.0)
91 | retriable (>= 2.0, < 4.0)
92 | signet (~> 0.12)
93 | google-cloud-core (1.5.0)
94 | google-cloud-env (~> 1.0)
95 | google-cloud-errors (~> 1.0)
96 | google-cloud-env (1.4.0)
97 | faraday (>= 0.17.3, < 2.0)
98 | google-cloud-errors (1.0.1)
99 | google-cloud-storage (1.29.1)
100 | addressable (~> 2.5)
101 | digest-crc (~> 0.4)
102 | google-api-client (~> 0.33)
103 | google-cloud-core (~> 1.2)
104 | googleauth (~> 0.9)
105 | mini_mime (~> 1.0)
106 | googleauth (0.14.0)
107 | faraday (>= 0.17.3, < 2.0)
108 | jwt (>= 1.4, < 3.0)
109 | memoist (~> 0.16)
110 | multi_json (~> 1.11)
111 | os (>= 0.9, < 2.0)
112 | signet (~> 0.14)
113 | highline (1.7.10)
114 | http-cookie (1.0.3)
115 | domain_name (~> 0.5)
116 | httpclient (2.8.3)
117 | jmespath (1.4.0)
118 | json (2.3.1)
119 | jwt (2.2.2)
120 | memoist (0.16.2)
121 | mini_magick (4.11.0)
122 | mini_mime (1.0.2)
123 | multi_json (1.15.0)
124 | multipart-post (2.0.0)
125 | nanaimo (0.3.0)
126 | naturally (2.2.0)
127 | os (1.1.1)
128 | plist (3.5.0)
129 | public_suffix (4.0.6)
130 | rake (13.0.1)
131 | representable (3.0.4)
132 | declarative (< 0.1.0)
133 | declarative-option (< 0.2.0)
134 | uber (< 0.2.0)
135 | retriable (3.1.2)
136 | rouge (2.0.7)
137 | ruby2_keywords (0.0.2)
138 | rubyzip (2.3.0)
139 | security (0.1.3)
140 | signet (0.14.0)
141 | addressable (~> 2.3)
142 | faraday (>= 0.17.3, < 2.0)
143 | jwt (>= 1.5, < 3.0)
144 | multi_json (~> 1.10)
145 | simctl (1.6.8)
146 | CFPropertyList
147 | naturally
148 | slack-notifier (2.3.2)
149 | terminal-notifier (2.0.0)
150 | terminal-table (1.8.0)
151 | unicode-display_width (~> 1.1, >= 1.1.1)
152 | tty-cursor (0.7.1)
153 | tty-screen (0.8.1)
154 | tty-spinner (0.9.3)
155 | tty-cursor (~> 0.7)
156 | uber (0.1.0)
157 | unf (0.1.4)
158 | unf_ext
159 | unf_ext (0.0.7.7)
160 | unicode-display_width (1.7.0)
161 | word_wrap (1.0.0)
162 | xcodeproj (1.19.0)
163 | CFPropertyList (>= 2.3.3, < 4.0)
164 | atomos (~> 0.1.3)
165 | claide (>= 1.0.2, < 2.0)
166 | colored2 (~> 3.1)
167 | nanaimo (~> 0.3.0)
168 | xcpretty (0.3.0)
169 | rouge (~> 2.0.7)
170 | xcpretty-travis-formatter (1.0.0)
171 | xcpretty (~> 0.2, >= 0.0.7)
172 |
173 | PLATFORMS
174 | ruby
175 |
176 | DEPENDENCIES
177 | fastlane (~> 2.166)
178 |
179 | BUNDLED WITH
180 | 2.1.4
181 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/webclients/CustomWebViewClient.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.webclients
2 |
3 | import android.content.Context
4 | import android.graphics.Color
5 | import android.net.Uri
6 | import android.os.Build
7 | import android.view.View
8 | import android.webkit.*
9 | import androidx.browser.customtabs.CustomTabsIntent
10 | import org.json.JSONObject
11 | import com.pusher.pushnotifications.PushNotifications
12 | import kotlinx.coroutines.*
13 | import org.greenrobot.eventbus.EventBus
14 | import org.greenrobot.eventbus.Subscribe
15 | import org.greenrobot.eventbus.ThreadMode
16 | import to.dev.dev_android.events.NetworkStatusEvent
17 | import to.dev.dev_android.util.network.*
18 | import java.lang.Exception
19 | import java.lang.Runnable
20 |
21 | class CustomWebViewClient(
22 | private val context: Context,
23 | private val view: WebView,
24 | private val coroutineScope: CoroutineScope,
25 | private val onPageFinish: () -> Unit
26 | ) : WebViewClient() {
27 |
28 | private val overrideUrlList = listOf(
29 | "://dev.to",
30 | "api.twitter.com/oauth",
31 | "api.twitter.com/login/error",
32 | "api.twitter.com/account/login_verification",
33 | "github.com/login",
34 | "github.com/sessions/"
35 | )
36 |
37 | private var registeredUserNotifications = false
38 |
39 | override fun onPageFinished(view: WebView, url: String?) {
40 | onPageFinish()
41 | view.visibility = View.VISIBLE
42 | super.onPageFinished(view, url)
43 | }
44 |
45 | override fun doUpdateVisitedHistory(view: WebView?, url: String?, isReload: Boolean) {
46 | val javascript = "JSON.parse(document.getElementsByTagName('body')[0].getAttribute('data-user')).id"
47 | view?.evaluateJavascript(javascript) { result ->
48 | if (result != "null" && !registeredUserNotifications) {
49 | try {
50 | val userId = result.toString().toInt()
51 | PushNotifications.addDeviceInterest("user-notifications-$userId")
52 | registeredUserNotifications = true
53 | }
54 | catch (e: Exception) {
55 | println(e)
56 | }
57 | }
58 | }
59 |
60 | super.doUpdateVisitedHistory(view, url, isReload)
61 | }
62 |
63 | override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
64 | if (view.originalUrl == "https://dev.to/signout_confirm" && url == "https://dev.to/") {
65 | view.clearCache(true)
66 | view.clearFormData()
67 | view.clearHistory()
68 | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
69 | CookieManager.getInstance().removeAllCookie()
70 | } else {
71 | CookieManager.getInstance().removeAllCookies(null)
72 | }
73 | }
74 |
75 | if (overrideUrlList.any { url.contains(it) }) {
76 | return false
77 | }
78 |
79 | CustomTabsIntent.Builder()
80 | .setToolbarColor(Color.parseColor("#00000000"))
81 | .build()
82 | .also { it.launchUrl(context, Uri.parse(url)) }
83 |
84 | return true
85 | }
86 |
87 | fun sendBridgeMessage(type: String, message: Map) {
88 | val jsonMessage = JSONObject(message).toString()
89 | var javascript = ""
90 | when(type) {
91 | "podcast" -> javascript = "document.getElementById('audiocontent').setAttribute('data-podcast', '$jsonMessage')"
92 | "video" -> javascript = "document.getElementById('video-player-source').setAttribute('data-message', '$jsonMessage')"
93 | else -> return
94 | }
95 | view?.post(Runnable {
96 | view?.evaluateJavascript(javascript, null)
97 | })
98 | }
99 |
100 | private var networkWatcher: NetworkWatcher? = null
101 | private fun registerNetworkWatcher() {
102 | if (networkWatcher != null) return
103 |
104 | unregisterNetworkWatcher()
105 |
106 | networkWatcher = NetworkWatcher(coroutineScope)
107 | }
108 |
109 | private fun unregisterNetworkWatcher() {
110 | networkWatcher?.let {
111 | context.unregisterReceiver(it)
112 |
113 | networkWatcher = null
114 | }
115 | }
116 |
117 | override fun onReceivedError(
118 | view: WebView?,
119 | request: WebResourceRequest?,
120 | error: WebResourceError?
121 | ) {
122 | super.onReceivedError(view, request, error)
123 |
124 | coroutineScope.launch {
125 | if (async { NetworkUtils.isOffline() }.await()) {
126 | EventBus.getDefault().post(NetworkStatusEvent(NetworkStatus.OFFLINE))
127 | }
128 | }
129 | }
130 |
131 | @Subscribe(threadMode = ThreadMode.BACKGROUND)
132 | fun onNetworkStatusEvent(event: NetworkStatusEvent) {
133 | when (event.networkStatus) {
134 | NetworkStatus.OFFLINE -> {
135 | registerNetworkWatcher()
136 |
137 | context.registerReceiver(networkWatcher, NetworkWatcher.intentFilter)
138 | }
139 | NetworkStatus.BACK_ONLINE -> {
140 | unregisterNetworkWatcher()
141 |
142 | coroutineScope.launch {
143 | withContext(Dispatchers.Main) {
144 | view.loadUrl(view.url)
145 | }
146 | }
147 | }
148 | }
149 | }
150 |
151 | fun observeNetwork() {
152 | if(EventBus.getDefault().isRegistered(this))
153 | EventBus.getDefault().unregister(this)
154 | EventBus.getDefault().register(this)
155 | }
156 |
157 | fun unobserveNetwork() {
158 | coroutineScope.cancel()
159 | EventBus.getDefault().unregister(this)
160 |
161 | unregisterNetworkWatcher()
162 | }
163 | }
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/util/AndroidWebViewBridge.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.util
2 |
3 | import android.content.*
4 | import android.os.IBinder
5 | import android.util.Log
6 | import android.webkit.JavascriptInterface
7 | import android.widget.Toast
8 | import com.google.gson.Gson
9 | import org.greenrobot.eventbus.EventBus
10 | import org.greenrobot.eventbus.Subscribe
11 | import org.greenrobot.eventbus.ThreadMode
12 | import to.dev.dev_android.activities.VideoPlayerActivity
13 | import to.dev.dev_android.events.VideoPlayerPauseEvent
14 | import to.dev.dev_android.events.VideoPlayerTickEvent
15 | import to.dev.dev_android.media.AudioService
16 | import to.dev.dev_android.webclients.CustomWebViewClient
17 | import java.util.*
18 |
19 | class AndroidWebViewBridge(private val context: Context) {
20 |
21 | var webViewClient: CustomWebViewClient? = null
22 | private var timer: Timer? = null
23 |
24 | // audioService is initialized when onServiceConnected is executed after/during binding is done
25 | private var audioService: AudioService? = null
26 | private val connection = object : ServiceConnection {
27 | override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
28 | val binder = service as AudioService.AudioServiceBinder
29 | audioService = binder.service
30 | }
31 |
32 | override fun onServiceDisconnected(name: ComponentName?) {
33 | audioService = null
34 | }
35 | }
36 |
37 | @JavascriptInterface
38 | fun logError(errorTag: String, errorMessage: String) {
39 | Log.e(errorTag, errorMessage)
40 | }
41 |
42 | @JavascriptInterface
43 | fun copyToClipboard(copyText: String) {
44 | val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
45 | val clipData = ClipData.newPlainText("DEV Community", copyText)
46 | clipboard?.setPrimaryClip(clipData)
47 | }
48 |
49 | @JavascriptInterface
50 | fun showToast(message: String) {
51 | Toast.makeText(context, message, Toast.LENGTH_LONG).show()
52 | }
53 |
54 | @JavascriptInterface
55 | fun podcastMessage(message: String) {
56 | var map: Map = HashMap()
57 | map = Gson().fromJson(message, map.javaClass)
58 | when(map["action"]) {
59 | "load" -> loadPodcast(map["url"])
60 | "play" -> audioService?.play(map["url"], map["seconds"])
61 | "pause" -> audioService?.pause()
62 | "seek" -> audioService?.seekTo(map["seconds"])
63 | "rate" -> audioService?.rate(map["rate"])
64 | "muted" -> audioService?.mute(map["muted"])
65 | "volume" -> audioService?.volume(map["volume"])
66 | "metadata" -> audioService?.loadMetadata(map["episodeName"], map["podcastName"], map["imageUrl"])
67 | "terminate" -> terminatePodcast()
68 | else -> logError("Podcast Error", "Unknown action")
69 | }
70 | }
71 |
72 | @JavascriptInterface
73 | fun videoMessage(message: String) {
74 | var map: Map = HashMap()
75 | map = Gson().fromJson(message, map.javaClass)
76 | when(map["action"]) {
77 | "play" -> playVideo(map["url"], map["seconds"])
78 | else -> logError("Video Error", "Unknown action")
79 | }
80 | }
81 |
82 | fun playVideo(url: String?, seconds: String?) {
83 | url?.let {
84 | // Pause the audio player in case the user is currently listening to a audio (podcast)
85 | audioService?.pause()
86 | timer?.cancel()
87 |
88 | // Launch VideoPlayerActivity
89 | val intent = VideoPlayerActivity.newIntent(context, url, seconds ?: "0")
90 | context.startActivity(intent)
91 |
92 | EventBus.getDefault().register(this)
93 | }
94 | }
95 |
96 | fun loadPodcast(url: String?) {
97 | if (url == null) return
98 |
99 | AudioService.newIntent(context, url).also { intent ->
100 | context.bindService(intent, connection, Context.BIND_AUTO_CREATE)
101 | }
102 |
103 | // Clear out lingering timer if it exists & recreate
104 | timer?.cancel()
105 | timer = Timer()
106 | val timeUpdateTask = object: TimerTask() {
107 | override fun run() {
108 | podcastTimeUpdate()
109 | }
110 | }
111 | timer?.schedule(timeUpdateTask, 0, 1000)
112 | }
113 |
114 | fun terminatePodcast() {
115 | timer?.cancel()
116 | timer = null
117 | audioService?.let {
118 | it.pause()
119 | context.unbindService(connection)
120 | context.stopService(Intent(context, AudioService::class.java))
121 | audioService = null
122 | }
123 | }
124 |
125 | fun podcastTimeUpdate() {
126 | audioService?.let {
127 | val time = it.currentTimeInSec() / 1000
128 | val duration = it.durationInSec() / 1000
129 | if (duration < 0) {
130 | // The duration overflows into a negative when waiting to load audio (initializing)
131 | webViewClient?.sendBridgeMessage("podcast", mapOf("action" to "init"))
132 | } else {
133 | val message = mapOf("action" to "tick", "duration" to duration, "currentTime" to time)
134 | webViewClient?.sendBridgeMessage("podcast", message)
135 | }
136 | }
137 | }
138 |
139 | @Subscribe(threadMode = ThreadMode.MAIN)
140 | fun onMessageEvent(event: VideoPlayerPauseEvent) {
141 | webViewClient?.sendBridgeMessage("video", mapOf("action" to event.action))
142 | EventBus.getDefault().unregister(this)
143 | }
144 |
145 | @Subscribe(threadMode = ThreadMode.MAIN)
146 | fun onMessageEvent(event: VideoPlayerTickEvent) {
147 | val message = mapOf("action" to event.action, "currentTime" to event.seconds)
148 | webViewClient?.sendBridgeMessage("video", message)
149 | }
150 |
151 | /**
152 | * This method is used to open the native share-sheet of Android when simple text is to be
153 | * shared from the web-view.
154 | */
155 | @JavascriptInterface
156 | fun shareText(text: String) {
157 | val shareIntent = Intent.createChooser(
158 | Intent().apply {
159 | action = Intent.ACTION_SEND
160 | putExtra(Intent.EXTRA_TEXT, text)
161 | type = "text/plain"
162 | },
163 | null
164 | )
165 | context.startActivity(shareIntent)
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/activities/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.activities
2 |
3 | import android.annotation.SuppressLint
4 | import android.app.Activity
5 | import android.content.Intent
6 | import android.net.Uri
7 | import android.os.Build
8 | import android.os.Bundle
9 | import android.util.Log
10 | import android.view.View
11 | import android.webkit.ValueCallback
12 | import android.webkit.WebView
13 | import com.pusher.pushnotifications.PushNotifications
14 | import kotlinx.coroutines.MainScope
15 | import kotlinx.coroutines.cancel
16 | import to.dev.dev_android.R
17 | import to.dev.dev_android.BuildConfig
18 | import to.dev.dev_android.databinding.ActivityMainBinding
19 | import to.dev.dev_android.util.AndroidWebViewBridge
20 | import to.dev.dev_android.webclients.CustomWebChromeClient
21 | import to.dev.dev_android.webclients.CustomWebViewClient
22 |
23 | class MainActivity : BaseActivity(), CustomWebChromeClient.CustomListener {
24 | private val webViewBridge: AndroidWebViewBridge = AndroidWebViewBridge(this)
25 | private lateinit var webViewClient: CustomWebViewClient
26 |
27 | private var filePathCallback: ValueCallback>? = null
28 |
29 | private val mainActivityScope = MainScope()
30 |
31 | override fun layout(): Int {
32 | return R.layout.activity_main
33 | }
34 |
35 | override fun onCreate(savedInstanceState: Bundle?) {
36 | super.onCreate(savedInstanceState)
37 | setWebViewSettings()
38 | savedInstanceState?.let { restoreState(it) } ?: navigateToHome()
39 | handleIntent(intent)
40 | PushNotifications.start(applicationContext, BuildConfig.pusherInstanceId)
41 | PushNotifications.addDeviceInterest("broadcast")
42 |
43 | binding.showPopupImageView.setOnClickListener {
44 | showForemAppAlert()
45 | }
46 |
47 | binding.openForemImageView.setOnClickListener {
48 | val url = binding.webView.url
49 | ForemAppDialog.openForemApp(this, url)
50 | }
51 | }
52 |
53 | override fun onResume() {
54 | if (intent.extras != null && intent.extras!!["url"] != null) {
55 | val targetUrl = intent.extras!!["url"].toString()
56 | try {
57 | val targetHost = Uri.parse(targetUrl).host ?: ""
58 | if (targetHost.contains(BuildConfig.baseHostname)) {
59 | binding.webView.loadUrl(targetUrl)
60 | }
61 | } catch (e: Exception) {
62 | Log.e(LOG_TAG, "${e.message}")
63 | }
64 | }
65 |
66 | if (ForemAppDialog.isForemAppAlreadyInstalled(this)) {
67 | binding.openForemImageView.visibility = View.VISIBLE
68 | } else {
69 | binding.openForemImageView.visibility = View.GONE
70 | }
71 |
72 | super.onResume()
73 | webViewClient.observeNetwork()
74 | }
75 |
76 | override fun onStop() {
77 | super.onStop()
78 | webViewClient.unobserveNetwork()
79 | }
80 |
81 | override fun onDestroy() {
82 | super.onDestroy()
83 |
84 | // Make sure we're not leaving any audio playing behind
85 | webViewBridge.terminatePodcast()
86 |
87 | // Coroutine cleanup
88 | mainActivityScope.cancel()
89 | }
90 |
91 | override fun onSaveInstanceState(outState: Bundle) {
92 | binding.webView.saveState(outState)
93 | super.onSaveInstanceState(outState)
94 | }
95 |
96 | override fun onNewIntent(intent: Intent) {
97 | super.onNewIntent(intent)
98 | handleIntent(intent)
99 | }
100 |
101 | private fun handleIntent(intent: Intent) {
102 | val appLinkData: Uri? = intent.data
103 | appLinkData?.host?.let {
104 | binding.webView.loadUrl(appLinkData.toString())
105 | }
106 | }
107 |
108 | @SuppressLint("SetJavaScriptEnabled")
109 | private fun setWebViewSettings() {
110 | if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
111 | WebView.setWebContentsDebuggingEnabled(true)
112 | }
113 |
114 | binding.webView.settings.javaScriptEnabled = true
115 | binding.webView.settings.domStorageEnabled = true
116 | binding.webView.settings.userAgentString = BuildConfig.userAgent
117 |
118 | binding.webView.addJavascriptInterface(webViewBridge, "AndroidBridge")
119 | webViewClient = CustomWebViewClient(
120 | this@MainActivity,
121 | binding.webView,
122 | mainActivityScope
123 | ) {
124 | binding.splash.visibility = View.GONE
125 | binding.webView.visibility = View.VISIBLE
126 | binding.bottomLayout.visibility = View.VISIBLE
127 | showForemAppAlert()
128 | }
129 | binding.webView.webViewClient = webViewClient
130 | webViewBridge.webViewClient = webViewClient
131 | binding.webView.webChromeClient = CustomWebChromeClient(BuildConfig.baseUrl, this)
132 | }
133 |
134 | private fun showForemAppAlert() {
135 | val url: String = binding.webView.url ?: ""
136 | ForemAppDialog.newInstance(url).show(
137 | supportFragmentManager,
138 | "ForemAppDialogFragment"
139 | )
140 | }
141 |
142 | private fun restoreState(savedInstanceState: Bundle) {
143 | binding.webView.restoreState(savedInstanceState)
144 | }
145 |
146 | private fun navigateToHome() {
147 | binding.webView.loadUrl(BuildConfig.baseUrl)
148 | }
149 |
150 | override fun onBackPressed() {
151 | if (binding.webView.canGoBack()) {
152 | binding.webView.goBack()
153 | } else {
154 | super.onBackPressed()
155 | }
156 | }
157 |
158 | override fun launchGallery(filePathCallback: ValueCallback>?) {
159 | this.filePathCallback = filePathCallback
160 |
161 | val galleryIntent = Intent().apply {
162 | // Show only images, no videos or anything else
163 | type = "image/*"
164 | action = Intent.ACTION_PICK
165 | }
166 |
167 | // Always show the chooser (if there are multiple options available)
168 | startActivityForResult(
169 | Intent.createChooser(galleryIntent, "Select Picture"),
170 | PIC_CHOOSER_REQUEST,
171 | null // No additional data
172 | )
173 | }
174 |
175 | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
176 | if (requestCode != PIC_CHOOSER_REQUEST) {
177 | return super.onActivityResult(requestCode, resultCode, data)
178 | }
179 |
180 | when (resultCode) {
181 | Activity.RESULT_OK -> data?.data?.let {
182 | filePathCallback?.onReceiveValue(arrayOf(it))
183 | filePathCallback = null
184 | }
185 | Activity.RESULT_CANCELED -> {
186 | filePathCallback?.onReceiveValue(null)
187 | filePathCallback = null
188 | }
189 | }
190 | }
191 |
192 | companion object {
193 | private const val PIC_CHOOSER_REQUEST = 100
194 | private const val LOG_TAG = "MainActivity"
195 | }
196 | }
197 |
--------------------------------------------------------------------------------
/app/src/main/java/to/dev/dev_android/media/AudioService.kt:
--------------------------------------------------------------------------------
1 | package to.dev.dev_android.media
2 |
3 | import android.app.Notification
4 | import android.app.PendingIntent
5 | import android.content.Context
6 | import android.content.Intent
7 | import android.graphics.Bitmap
8 | import android.media.MediaMetadata
9 | import android.net.Uri
10 | import android.os.Binder
11 | import android.os.Build
12 | import android.os.IBinder
13 | import android.support.v4.media.MediaMetadataCompat
14 | import android.support.v4.media.session.MediaSessionCompat
15 | import androidx.annotation.MainThread
16 | import androidx.annotation.Nullable
17 | import androidx.lifecycle.LifecycleService
18 | import com.google.android.exoplayer2.*
19 | import com.google.android.exoplayer2.audio.AudioAttributes
20 | import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
21 | import com.google.android.exoplayer2.source.ProgressiveMediaSource
22 | import com.google.android.exoplayer2.ui.PlayerNotificationManager
23 | import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
24 | import to.dev.dev_android.R
25 | import to.dev.dev_android.BuildConfig
26 |
27 | class AudioService : LifecycleService() {
28 | private val binder = AudioServiceBinder()
29 |
30 | private var currentPodcastUrl: String? = null
31 | private var episodeName: String? = null
32 | private var podcastName: String? = null
33 | private var imageUrl: String? = null
34 |
35 | private var player: SimpleExoPlayer? = null
36 | private var playerNotificationManager: PlayerNotificationManager? = null
37 | private var mediaSession: MediaSessionCompat? = null
38 |
39 | inner class AudioServiceBinder : Binder() {
40 | val service: AudioService
41 | get() = this@AudioService
42 | }
43 |
44 | companion object {
45 | @MainThread
46 | fun newIntent(
47 | context: Context,
48 | episodeUrl: String
49 | ) = Intent(context, AudioService::class.java).apply {
50 | putExtra(argPodcastUrl, episodeUrl)
51 | }
52 |
53 | const val argPodcastUrl = "ARG_PODCAST_URL"
54 | const val playbackChannelId = "playback_channel"
55 | const val mediaSessionTag = "DEV Community Session"
56 | const val playbackNotificationId = 1
57 | const val incrementMs = 15000
58 | }
59 |
60 | override fun onBind(intent: Intent): IBinder {
61 | super.onBind(intent)
62 |
63 | val newPodcastUrl = intent.getStringExtra(argPodcastUrl)
64 | if (currentPodcastUrl != newPodcastUrl) {
65 | currentPodcastUrl = newPodcastUrl
66 | preparePlayer()
67 | }
68 |
69 | return binder
70 | }
71 |
72 | override fun onCreate() {
73 | super.onCreate()
74 |
75 | player = SimpleExoPlayer.Builder(this).build()
76 | player?.audioAttributes = AudioAttributes.Builder()
77 | .setUsage(C.USAGE_MEDIA)
78 | .setContentType(C.CONTENT_TYPE_SPEECH)
79 | .build()
80 |
81 | playerNotificationManager = PodcastPlayerNotificationManager.createWithNotificationChannel(
82 | applicationContext,
83 | playbackChannelId,
84 | R.string.app_name,
85 | R.string.playback_channel_description,
86 | playbackNotificationId,
87 | object : PlayerNotificationManager.MediaDescriptionAdapter {
88 | override fun getCurrentContentTitle(player: Player): String {
89 | return episodeName ?: getString(R.string.app_name)
90 | }
91 |
92 | @Nullable
93 | override fun createCurrentContentIntent(player: Player): PendingIntent? = null
94 |
95 | @Nullable
96 | override fun getCurrentContentText(player: Player): String? {
97 | return podcastName ?: getString(R.string.playback_channel_description)
98 | }
99 |
100 | @Nullable
101 | override fun getCurrentLargeIcon(
102 | player: Player,
103 | callback: PlayerNotificationManager.BitmapCallback
104 | ): Bitmap? {
105 | return null
106 | }
107 | },
108 | object : PlayerNotificationManager.NotificationListener {
109 | override fun onNotificationStarted(
110 | notificationId: Int,
111 | notification: Notification
112 | ) {
113 | startForeground(notificationId, notification)
114 | }
115 |
116 | override fun onNotificationCancelled(notificationId: Int) {
117 | stopSelf()
118 | }
119 |
120 | override fun onNotificationPosted(
121 | notificationId: Int,
122 | notification: Notification,
123 | ongoing: Boolean
124 | ) {
125 | if (ongoing) {
126 | // Make sure the service will not get destroyed while playing media.
127 | startForeground(notificationId, notification)
128 | } else {
129 | // Make notification cancellable.
130 | stopForeground(false)
131 | }
132 | }
133 | }
134 | ).apply {
135 | setUseNavigationActions(false)
136 | setUseStopAction(true)
137 | setUseNavigationActionsInCompactView(true)
138 | setFastForwardIncrementMs(incrementMs.toLong())
139 | setRewindIncrementMs(incrementMs.toLong())
140 | setPlayer(player)
141 | invalidate()
142 | }
143 |
144 | // Show lock screen controls and let apps like Google assistant manager playback.
145 | mediaSession = MediaSessionCompat(this, mediaSessionTag)
146 | val builder = MediaMetadataCompat.Builder()
147 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
148 | builder.putString(MediaMetadata.METADATA_KEY_TITLE, episodeName)
149 | .putString(MediaMetadata.METADATA_KEY_ARTIST, podcastName)
150 | }
151 | mediaSession?.setMetadata(builder.build())
152 | playerNotificationManager?.setMediaSessionToken(mediaSession!!.sessionToken)
153 | }
154 |
155 | @MainThread
156 | fun play(audioUrl: String?, seconds: String?) {
157 | if (currentPodcastUrl != audioUrl) {
158 | currentPodcastUrl = audioUrl
159 | preparePlayer()
160 | seekTo("0")
161 | } else {
162 | seekTo(seconds)
163 | }
164 | player?.playWhenReady = true
165 | }
166 |
167 | @MainThread
168 | fun pause() {
169 | player?.playWhenReady = false
170 | }
171 |
172 | @MainThread
173 | fun mute(muted: String?) {
174 | muted?.toBoolean()?.let {
175 | if (it) {
176 | player?.volume = 0F
177 | } else {
178 | player?.volume = 1F
179 | }
180 | }
181 | }
182 |
183 | @MainThread
184 | fun volume(volume: String?) {
185 | volume?.toFloat()?.let {
186 | player?.volume = it
187 | }
188 | }
189 |
190 | @MainThread
191 | fun rate(rate: String?) {
192 | rate?.toFloat()?.let {
193 | player?.setPlaybackParameters(PlaybackParameters(it))
194 | }
195 | }
196 |
197 | @MainThread
198 | fun seekTo(seconds: String?) {
199 | seconds?.toFloat()?.let {
200 | player?.seekTo((it * 1000F).toLong())
201 | }
202 | }
203 |
204 | @MainThread
205 | fun loadMetadata(epName: String?, pdName: String?, url: String?) {
206 | episodeName = epName
207 | podcastName = pdName
208 | imageUrl = url
209 | }
210 |
211 | @MainThread
212 | fun currentTimeInSec() : Long {
213 | return player?.currentPosition ?: 0
214 | }
215 |
216 | @MainThread
217 | fun durationInSec() : Long {
218 | return player?.duration ?: 0L
219 | }
220 |
221 | @MainThread
222 | private fun preparePlayer() {
223 | player?.playWhenReady = false
224 |
225 | // Allows the data source to be seekable
226 | val extractorsFactory: DefaultExtractorsFactory =
227 | DefaultExtractorsFactory().setConstantBitrateSeekingEnabled(true)
228 |
229 | val dataSourceFactory = DefaultDataSourceFactory(this, BuildConfig.userAgent)
230 | val streamUri = Uri.parse(currentPodcastUrl)
231 | val mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory)
232 | .createMediaSource(streamUri)
233 | player?.prepare(mediaSource)
234 | }
235 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [1.5.0](https://github.com/thepracticaldev/DEV-Android/tree/1.5.0) (2020-11-16)
4 |
5 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.4.2...1.5.0)
6 |
7 | **Fixed bugs:**
8 |
9 | - App crashing upon trying to login [\#98](https://github.com/thepracticaldev/DEV-Android/issues/98)
10 | - App crashes immediately \(can't open\) - Android 5.0 Lollipop [\#94](https://github.com/thepracticaldev/DEV-Android/issues/94)
11 | - Add a Swipe to Refresh option [\#76](https://github.com/thepracticaldev/DEV-Android/issues/76)
12 | - Title "MY READING LIST \(EMPTY\) is clipped on the navigation menu [\#17](https://github.com/thepracticaldev/DEV-Android/issues/17)
13 |
14 | **Closed issues:**
15 |
16 | - App crashes after closing it [\#106](https://github.com/thepracticaldev/DEV-Android/issues/106)
17 | - Android app is broken [\#105](https://github.com/thepracticaldev/DEV-Android/issues/105)
18 | - Bump the project minimum SDK API [\#88](https://github.com/thepracticaldev/DEV-Android/issues/88)
19 | - Push Notification [\#10](https://github.com/thepracticaldev/DEV-Android/issues/10)
20 |
21 | **Merged pull requests:**
22 |
23 | - Removes duplicate ic\_launcher\_foreground.xml [\#114](https://github.com/thepracticaldev/DEV-Android/pull/114) ([fdoxyz](https://github.com/fdoxyz))
24 | - .gitignore bump [\#112](https://github.com/thepracticaldev/DEV-Android/pull/112) ([fdoxyz](https://github.com/fdoxyz))
25 | - Setup fastlane for CI/CD [\#110](https://github.com/thepracticaldev/DEV-Android/pull/110) ([maestromac](https://github.com/maestromac))
26 | - Updates Gradle Wrapper from 6.2.1 to 6.7 [\#109](https://github.com/thepracticaldev/DEV-Android/pull/109) ([github-actions[bot]](https://github.com/apps/github-actions))
27 | - Fix bug on MainActivity onDestro. App crashes when closing the app with back button [\#107](https://github.com/thepracticaldev/DEV-Android/pull/107) ([fdoxyz](https://github.com/fdoxyz))
28 | - Bumped minSdkVersion to 21 [\#104](https://github.com/thepracticaldev/DEV-Android/pull/104) ([Stuie](https://github.com/Stuie))
29 | - Add workflow for Update Gradle Wrapper Action [\#102](https://github.com/thepracticaldev/DEV-Android/pull/102) ([cristiangreco](https://github.com/cristiangreco))
30 | - 🏗 Setup a GitHub Action using Gradle to run the unit tests \#2 [\#100](https://github.com/thepracticaldev/DEV-Android/pull/100) ([jmfayard](https://github.com/jmfayard))
31 |
32 | ## [1.4.2](https://github.com/thepracticaldev/DEV-Android/tree/1.4.2) (2020-09-15)
33 |
34 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.4.1-11...1.4.2)
35 |
36 | **Fixed bugs:**
37 |
38 | - Web Share API not working [\#11](https://github.com/thepracticaldev/DEV-Android/issues/11)
39 |
40 | **Merged pull requests:**
41 |
42 | - Bumps targetSdkVersion to support API 29 [\#101](https://github.com/thepracticaldev/DEV-Android/pull/101) ([fdoxyz](https://github.com/fdoxyz))
43 | - \#94 fixed event bus related app crushing issue on Android 5.0 Lollipop [\#96](https://github.com/thepracticaldev/DEV-Android/pull/96) ([bluetoothfx](https://github.com/bluetoothfx))
44 | - Add method to open native share sheet from within web-view. [\#61](https://github.com/thepracticaldev/DEV-Android/pull/61) ([VarunBarad](https://github.com/VarunBarad))
45 |
46 | ## [1.4.1-11](https://github.com/thepracticaldev/DEV-Android/tree/1.4.1-11) (2020-07-21)
47 |
48 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.4.1...1.4.1-11)
49 |
50 | **Fixed bugs:**
51 |
52 | - Can't play video on google pixel [\#86](https://github.com/thepracticaldev/DEV-Android/issues/86)
53 |
54 | **Closed issues:**
55 |
56 | - Title [\#84](https://github.com/thepracticaldev/DEV-Android/issues/84)
57 |
58 | **Merged pull requests:**
59 |
60 | - Support for video messaging back into the DOM & other enhancements [\#92](https://github.com/thepracticaldev/DEV-Android/pull/92) ([fdoxyz](https://github.com/fdoxyz))
61 | - Native video streaming support [\#90](https://github.com/thepracticaldev/DEV-Android/pull/90) ([fdoxyz](https://github.com/fdoxyz))
62 | - Filter incoming URL data from MainActivity intent handling [\#89](https://github.com/thepracticaldev/DEV-Android/pull/89) ([fdoxyz](https://github.com/fdoxyz))
63 |
64 | ## [1.4.1](https://github.com/thepracticaldev/DEV-Android/tree/1.4.1) (2020-05-29)
65 |
66 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.4...1.4.1)
67 |
68 | **Fixed bugs:**
69 |
70 | - Login via Twitter issue [\#82](https://github.com/thepracticaldev/DEV-Android/issues/82)
71 | - Image uploading still doesn't work [\#51](https://github.com/thepracticaldev/DEV-Android/issues/51)
72 |
73 | **Closed issues:**
74 |
75 | - Duplicate .gitignore files in the repository [\#78](https://github.com/thepracticaldev/DEV-Android/issues/78)
76 |
77 | **Merged pull requests:**
78 |
79 | - Includes error url to override for twitter authentication [\#83](https://github.com/thepracticaldev/DEV-Android/pull/83) ([fdoxyz](https://github.com/fdoxyz))
80 | - Removed duplicate .gitignore files and contents merged into one root [\#80](https://github.com/thepracticaldev/DEV-Android/pull/80) ([Rec0iL99](https://github.com/Rec0iL99))
81 | - Implemented Auto Refresh for WebView [\#77](https://github.com/thepracticaldev/DEV-Android/pull/77) ([nizarmah](https://github.com/nizarmah))
82 | - Some cleanup and enhancements to the Native Audio implementation [\#75](https://github.com/thepracticaldev/DEV-Android/pull/75) ([fdoxyz](https://github.com/fdoxyz))
83 |
84 | ## [1.4](https://github.com/thepracticaldev/DEV-Android/tree/1.4) (2020-05-01)
85 |
86 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.3.1...1.4)
87 |
88 | **Fixed bugs:**
89 |
90 | - Authentication error with GitHub [\#73](https://github.com/thepracticaldev/DEV-Android/issues/73)
91 |
92 | **Merged pull requests:**
93 |
94 | - Native Audio Player [\#72](https://github.com/thepracticaldev/DEV-Android/pull/72) ([fdoxyz](https://github.com/fdoxyz))
95 |
96 | ## [1.3.1](https://github.com/thepracticaldev/DEV-Android/tree/1.3.1) (2020-04-30)
97 |
98 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.3...1.3.1)
99 |
100 | **Merged pull requests:**
101 |
102 | - Reverts changes made to AndroidManifest.xml [\#74](https://github.com/thepracticaldev/DEV-Android/pull/74) ([fdoxyz](https://github.com/fdoxyz))
103 |
104 | ## [1.3](https://github.com/thepracticaldev/DEV-Android/tree/1.3) (2020-04-24)
105 |
106 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.2.2...1.3)
107 |
108 | **Merged pull requests:**
109 |
110 | - Adds Pusher beams and code that enables push notifications handling [\#68](https://github.com/thepracticaldev/DEV-Android/pull/68) ([fdoxyz](https://github.com/fdoxyz))
111 |
112 | ## [1.2.2](https://github.com/thepracticaldev/DEV-Android/tree/1.2.2) (2020-04-22)
113 |
114 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.2.1...1.2.2)
115 |
116 | **Merged pull requests:**
117 |
118 | - Disable backup [\#71](https://github.com/thepracticaldev/DEV-Android/pull/71) ([maestromac](https://github.com/maestromac))
119 | - Adds native bridge ability to handle "copy to clipboard" requests from JS [\#70](https://github.com/thepracticaldev/DEV-Android/pull/70) ([fdoxyz](https://github.com/fdoxyz))
120 | - Add methods to implement native copy-to-clipboard functionality. [\#60](https://github.com/thepracticaldev/DEV-Android/pull/60) ([VarunBarad](https://github.com/VarunBarad))
121 |
122 | ## [1.2.1](https://github.com/thepracticaldev/DEV-Android/tree/1.2.1) (2020-03-30)
123 |
124 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.2...1.2.1)
125 |
126 | **Fixed bugs:**
127 |
128 | - Copy URL broken & Android share dialog [\#58](https://github.com/thepracticaldev/DEV-Android/issues/58)
129 | - Stuck on Offline page upon start [\#36](https://github.com/thepracticaldev/DEV-Android/issues/36)
130 | - Unable to upload profile image in android mobile app [\#33](https://github.com/thepracticaldev/DEV-Android/issues/33)
131 | - The App does not load user profile or articles [\#24](https://github.com/thepracticaldev/DEV-Android/issues/24)
132 | - Choose File option does not work [\#18](https://github.com/thepracticaldev/DEV-Android/issues/18)
133 |
134 | **Closed issues:**
135 |
136 | - upgrade pip 20.0.1 [\#65](https://github.com/thepracticaldev/DEV-Android/issues/65)
137 | - App looses state when external link is open or when its sent to background [\#48](https://github.com/thepracticaldev/DEV-Android/issues/48)
138 | - Adding Detekt [\#45](https://github.com/thepracticaldev/DEV-Android/issues/45)
139 | - Does Dev share API? [\#38](https://github.com/thepracticaldev/DEV-Android/issues/38)
140 | - Clear back history on tapping home link [\#35](https://github.com/thepracticaldev/DEV-Android/issues/35)
141 | - Unable to upload profile image in android mobile app [\#32](https://github.com/thepracticaldev/DEV-Android/issues/32)
142 | - Unable to upload profile image in android mobile app [\#31](https://github.com/thepracticaldev/DEV-Android/issues/31)
143 |
144 | **Merged pull requests:**
145 |
146 | - Upgrade Gradle and runtime dependencies [\#64](https://github.com/thepracticaldev/DEV-Android/pull/64) ([msfjarvis](https://github.com/msfjarvis))
147 | - Delete removed custom gradle task `clean` from README. [\#59](https://github.com/thepracticaldev/DEV-Android/pull/59) ([VarunBarad](https://github.com/VarunBarad))
148 | - The binding should not be passed around [\#57](https://github.com/thepracticaldev/DEV-Android/pull/57) ([sierisimo](https://github.com/sierisimo))
149 | - Adding 'when' to substitute if [\#56](https://github.com/thepracticaldev/DEV-Android/pull/56) ([sierisimo](https://github.com/sierisimo))
150 | - The 'clean' task is already present [\#55](https://github.com/thepracticaldev/DEV-Android/pull/55) ([sierisimo](https://github.com/sierisimo))
151 | - Updating versions to latest [\#54](https://github.com/thepracticaldev/DEV-Android/pull/54) ([sierisimo](https://github.com/sierisimo))
152 | - Add a bridge between WebView JavaScript and native Android code. [\#53](https://github.com/thepracticaldev/DEV-Android/pull/53) ([VarunBarad](https://github.com/VarunBarad))
153 | - Bug/save webview state retain history [\#52](https://github.com/thepracticaldev/DEV-Android/pull/52) ([sduduzog](https://github.com/sduduzog))
154 | - Refactor and clean-up build [\#50](https://github.com/thepracticaldev/DEV-Android/pull/50) ([jmfayard](https://github.com/jmfayard))
155 | - Add detekt static analysis [\#47](https://github.com/thepracticaldev/DEV-Android/pull/47) ([xuhaibahmad](https://github.com/xuhaibahmad))
156 | - Update Android Gradle plugin to 3.5.0 [\#46](https://github.com/thepracticaldev/DEV-Android/pull/46) ([friederbluemle](https://github.com/friederbluemle))
157 | - Dependencies management with Gradle buildSrcVersions [\#44](https://github.com/thepracticaldev/DEV-Android/pull/44) ([jmfayard](https://github.com/jmfayard))
158 | - Uprev AGP from 3.4.1 to 3.4.2 [\#43](https://github.com/thepracticaldev/DEV-Android/pull/43) ([msfjarvis](https://github.com/msfjarvis))
159 | - Dependency upgrades [\#42](https://github.com/thepracticaldev/DEV-Android/pull/42) ([msfjarvis](https://github.com/msfjarvis))
160 | - Migrate to Gradle Kotlin DSL [\#41](https://github.com/thepracticaldev/DEV-Android/pull/41) ([dbaelz](https://github.com/dbaelz))
161 | - Moving code into JDK8 [\#40](https://github.com/thepracticaldev/DEV-Android/pull/40) ([sierisimo](https://github.com/sierisimo))
162 | - Clear history when returning to home [\#39](https://github.com/thepracticaldev/DEV-Android/pull/39) ([robertoissc](https://github.com/robertoissc))
163 | - fix: Fixes issue to launch file chooser every time [\#34](https://github.com/thepracticaldev/DEV-Android/pull/34) ([subbramanil](https://github.com/subbramanil))
164 |
165 | ## [1.2](https://github.com/thepracticaldev/DEV-Android/tree/1.2) (2019-05-30)
166 |
167 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.1...1.2)
168 |
169 | **Closed issues:**
170 |
171 | - Image Upload Tool Not Working [\#29](https://github.com/thepracticaldev/DEV-Android/issues/29)
172 | - Moving `main url` out of `strings.xml` [\#20](https://github.com/thepracticaldev/DEV-Android/issues/20)
173 |
174 | **Merged pull requests:**
175 |
176 | - Fix Android lint warnings [\#30](https://github.com/thepracticaldev/DEV-Android/pull/30) ([robertoissc](https://github.com/robertoissc))
177 | - Codestyle and dependency upgrades [\#28](https://github.com/thepracticaldev/DEV-Android/pull/28) ([msfjarvis](https://github.com/msfjarvis))
178 | - Feature/Moving `main url` out of `strings.xml` [\#27](https://github.com/thepracticaldev/DEV-Android/pull/27) ([VarunBarad](https://github.com/VarunBarad))
179 | - fix: Choose File Option Not Working Issue [\#26](https://github.com/thepracticaldev/DEV-Android/pull/26) ([subbramanil](https://github.com/subbramanil))
180 | - Codestyle cleanup [\#22](https://github.com/thepracticaldev/DEV-Android/pull/22) ([msfjarvis](https://github.com/msfjarvis))
181 |
182 | ## [1.1](https://github.com/thepracticaldev/DEV-Android/tree/1.1) (2019-04-30)
183 |
184 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/1.0...1.1)
185 |
186 | **Fixed bugs:**
187 |
188 | - Update Adaptive Icon [\#13](https://github.com/thepracticaldev/DEV-Android/issues/13)
189 | - Signing in with Firefox as the default browser does not work [\#12](https://github.com/thepracticaldev/DEV-Android/issues/12)
190 |
191 | **Merged pull requests:**
192 |
193 | - Fix sign in issue [\#21](https://github.com/thepracticaldev/DEV-Android/pull/21) ([maestromac](https://github.com/maestromac))
194 | - Set adaptive icon background to black and update readme [\#19](https://github.com/thepracticaldev/DEV-Android/pull/19) ([jhw866](https://github.com/jhw866))
195 | - Update dependencies [\#16](https://github.com/thepracticaldev/DEV-Android/pull/16) ([msfjarvis](https://github.com/msfjarvis))
196 | - Refactored to AndroidX [\#15](https://github.com/thepracticaldev/DEV-Android/pull/15) ([tujson](https://github.com/tujson))
197 | - Update README [\#9](https://github.com/thepracticaldev/DEV-Android/pull/9) ([maestromac](https://github.com/maestromac))
198 | - Code of Conduct [\#8](https://github.com/thepracticaldev/DEV-Android/pull/8) ([jessleenyc](https://github.com/jessleenyc))
199 |
200 | ## [1.0](https://github.com/thepracticaldev/DEV-Android/tree/1.0) (2019-04-18)
201 |
202 | [Full Changelog](https://github.com/thepracticaldev/DEV-Android/compare/c5252691c5d8befa7555399e7dbec2ec36209db3...1.0)
203 |
204 | **Closed issues:**
205 |
206 | - Interested to contribute on the following project [\#6](https://github.com/thepracticaldev/DEV-Android/issues/6)
207 | - Chrome share only shares Dev.to [\#5](https://github.com/thepracticaldev/DEV-Android/issues/5)
208 |
209 | **Merged pull requests:**
210 |
211 | - Create base architecture [\#7](https://github.com/thepracticaldev/DEV-Android/pull/7) ([luchfilip](https://github.com/luchfilip))
212 |
213 |
214 |
215 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
216 |
--------------------------------------------------------------------------------
/config/detekt/detekt.yml:
--------------------------------------------------------------------------------
1 | build:
2 | maxIssues: 10
3 | weights:
4 | # complexity: 2
5 | # LongParameterList: 1
6 | # style: 1
7 | # comments: 1
8 |
9 | processors:
10 | active: true
11 | exclude:
12 | # - 'DetektProgressListener'
13 | # - 'FunctionCountProcessor'
14 | # - 'PropertyCountProcessor'
15 | # - 'ClassCountProcessor'
16 | # - 'PackageCountProcessor'
17 | # - 'KtFileCountProcessor'
18 |
19 | console-reports:
20 | active: true
21 | exclude:
22 | # - 'ProjectStatisticsReport'
23 | # - 'ComplexityReport'
24 | # - 'NotificationReport'
25 | # - 'FindingsReport'
26 | # - 'BuildFailureReport'
27 |
28 | comments:
29 | active: true
30 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
31 | CommentOverPrivateFunction:
32 | active: false
33 | CommentOverPrivateProperty:
34 | active: false
35 | EndOfSentenceFormat:
36 | active: false
37 | endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!:]$)
38 | UndocumentedPublicClass:
39 | active: false
40 | searchInNestedClass: true
41 | searchInInnerClass: true
42 | searchInInnerObject: true
43 | searchInInnerInterface: true
44 | UndocumentedPublicFunction:
45 | active: false
46 |
47 | complexity:
48 | active: true
49 | ComplexCondition:
50 | active: true
51 | threshold: 4
52 | ComplexInterface:
53 | active: false
54 | threshold: 10
55 | includeStaticDeclarations: false
56 | ComplexMethod:
57 | active: true
58 | threshold: 10
59 | ignoreSingleWhenExpression: false
60 | ignoreSimpleWhenEntries: false
61 | LabeledExpression:
62 | active: false
63 | ignoredLabels: ""
64 | LargeClass:
65 | active: true
66 | threshold: 600
67 | LongMethod:
68 | active: true
69 | threshold: 60
70 | LongParameterList:
71 | active: true
72 | threshold: 6
73 | ignoreDefaultParameters: false
74 | MethodOverloading:
75 | active: false
76 | threshold: 6
77 | NestedBlockDepth:
78 | active: true
79 | threshold: 4
80 | StringLiteralDuplication:
81 | active: false
82 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
83 | threshold: 3
84 | ignoreAnnotation: true
85 | excludeStringsWithLessThan5Characters: true
86 | ignoreStringsRegex: '$^'
87 | TooManyFunctions:
88 | active: true
89 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
90 | thresholdInFiles: 11
91 | thresholdInClasses: 11
92 | thresholdInInterfaces: 11
93 | thresholdInObjects: 11
94 | thresholdInEnums: 11
95 | ignoreDeprecated: false
96 | ignorePrivate: false
97 | ignoreOverridden: false
98 |
99 | empty-blocks:
100 | active: true
101 | EmptyCatchBlock:
102 | active: true
103 | allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
104 | EmptyClassBlock:
105 | active: true
106 | EmptyDefaultConstructor:
107 | active: true
108 | EmptyDoWhileBlock:
109 | active: true
110 | EmptyElseBlock:
111 | active: true
112 | EmptyFinallyBlock:
113 | active: true
114 | EmptyForBlock:
115 | active: true
116 | EmptyFunctionBlock:
117 | active: true
118 | ignoreOverriddenFunctions: false
119 | EmptyIfBlock:
120 | active: true
121 | EmptyInitBlock:
122 | active: true
123 | EmptyKtFile:
124 | active: true
125 | EmptySecondaryConstructor:
126 | active: true
127 | EmptyWhenBlock:
128 | active: true
129 | EmptyWhileBlock:
130 | active: true
131 |
132 | exceptions:
133 | active: true
134 | ExceptionRaisedInUnexpectedLocation:
135 | active: false
136 | methodNames: 'toString,hashCode,equals,finalize'
137 | InstanceOfCheckForException:
138 | active: false
139 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
140 | NotImplementedDeclaration:
141 | active: false
142 | PrintStackTrace:
143 | active: false
144 | RethrowCaughtException:
145 | active: false
146 | ReturnFromFinally:
147 | active: false
148 | SwallowedException:
149 | active: false
150 | ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException'
151 | allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
152 | ThrowingExceptionFromFinally:
153 | active: false
154 | ThrowingExceptionInMain:
155 | active: false
156 | ThrowingExceptionsWithoutMessageOrCause:
157 | active: false
158 | exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
159 | ThrowingNewInstanceOfSameException:
160 | active: false
161 | TooGenericExceptionCaught:
162 | active: true
163 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
164 | exceptionNames:
165 | - ArrayIndexOutOfBoundsException
166 | - Error
167 | - Exception
168 | - IllegalMonitorStateException
169 | - NullPointerException
170 | - IndexOutOfBoundsException
171 | - RuntimeException
172 | - Throwable
173 | allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
174 | TooGenericExceptionThrown:
175 | active: true
176 | exceptionNames:
177 | - Error
178 | - Exception
179 | - Throwable
180 | - RuntimeException
181 |
182 | formatting:
183 | active: true
184 | android: false
185 | autoCorrect: true
186 | AnnotationOnSeparateLine:
187 | active: false
188 | autoCorrect: true
189 | ChainWrapping:
190 | active: true
191 | autoCorrect: true
192 | CommentSpacing:
193 | active: true
194 | autoCorrect: true
195 | Filename:
196 | active: true
197 | FinalNewline:
198 | active: true
199 | autoCorrect: true
200 | ImportOrdering:
201 | active: false
202 | autoCorrect: true
203 | Indentation:
204 | active: false
205 | autoCorrect: true
206 | indentSize: 4
207 | continuationIndentSize: 4
208 | MaximumLineLength:
209 | active: true
210 | maxLineLength: 120
211 | ModifierOrdering:
212 | active: true
213 | autoCorrect: true
214 | MultiLineIfElse:
215 | active: true
216 | autoCorrect: true
217 | NoBlankLineBeforeRbrace:
218 | active: true
219 | autoCorrect: true
220 | NoConsecutiveBlankLines:
221 | active: true
222 | autoCorrect: true
223 | NoEmptyClassBody:
224 | active: true
225 | autoCorrect: true
226 | NoLineBreakAfterElse:
227 | active: true
228 | autoCorrect: true
229 | NoLineBreakBeforeAssignment:
230 | active: true
231 | autoCorrect: true
232 | NoMultipleSpaces:
233 | active: true
234 | autoCorrect: true
235 | NoSemicolons:
236 | active: true
237 | autoCorrect: true
238 | NoTrailingSpaces:
239 | active: true
240 | autoCorrect: true
241 | NoUnitReturn:
242 | active: true
243 | autoCorrect: true
244 | NoUnusedImports:
245 | active: true
246 | autoCorrect: true
247 | NoWildcardImports:
248 | active: true
249 | PackageName:
250 | active: true
251 | autoCorrect: true
252 | ParameterListWrapping:
253 | active: true
254 | autoCorrect: true
255 | indentSize: 4
256 | SpacingAroundColon:
257 | active: true
258 | autoCorrect: true
259 | SpacingAroundComma:
260 | active: true
261 | autoCorrect: true
262 | SpacingAroundCurly:
263 | active: true
264 | autoCorrect: true
265 | SpacingAroundDot:
266 | active: true
267 | autoCorrect: true
268 | SpacingAroundKeyword:
269 | active: true
270 | autoCorrect: true
271 | SpacingAroundOperators:
272 | active: true
273 | autoCorrect: true
274 | SpacingAroundParens:
275 | active: true
276 | autoCorrect: true
277 | SpacingAroundRangeOperator:
278 | active: true
279 | autoCorrect: true
280 | StringTemplate:
281 | active: true
282 | autoCorrect: true
283 |
284 | naming:
285 | active: true
286 | ClassNaming:
287 | active: true
288 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
289 | classPattern: '[A-Z$][a-zA-Z0-9$]*'
290 | ConstructorParameterNaming:
291 | active: true
292 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
293 | parameterPattern: '[a-z][A-Za-z0-9]*'
294 | privateParameterPattern: '[a-z][A-Za-z0-9]*'
295 | excludeClassPattern: '$^'
296 | EnumNaming:
297 | active: true
298 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
299 | enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
300 | ForbiddenClassName:
301 | active: false
302 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
303 | forbiddenName: ''
304 | FunctionMaxLength:
305 | active: false
306 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
307 | maximumFunctionNameLength: 30
308 | FunctionMinLength:
309 | active: false
310 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
311 | minimumFunctionNameLength: 3
312 | FunctionNaming:
313 | active: true
314 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
315 | functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
316 | excludeClassPattern: '$^'
317 | ignoreOverridden: true
318 | FunctionParameterNaming:
319 | active: true
320 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
321 | parameterPattern: '[a-z][A-Za-z0-9]*'
322 | excludeClassPattern: '$^'
323 | ignoreOverriddenFunctions: true
324 | InvalidPackageDeclaration:
325 | active: false
326 | rootPackage: ''
327 | MatchingDeclarationName:
328 | active: true
329 | MemberNameEqualsClassName:
330 | active: false
331 | ignoreOverriddenFunction: true
332 | ObjectPropertyNaming:
333 | active: true
334 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
335 | constantPattern: '[A-Za-z][_A-Za-z0-9]*'
336 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
337 | privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
338 | PackageNaming:
339 | active: true
340 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
341 | packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$'
342 | TopLevelPropertyNaming:
343 | active: true
344 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
345 | constantPattern: '[A-Z][_A-Z0-9]*'
346 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
347 | privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
348 | VariableMaxLength:
349 | active: false
350 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
351 | maximumVariableNameLength: 64
352 | VariableMinLength:
353 | active: false
354 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
355 | minimumVariableNameLength: 1
356 | VariableNaming:
357 | active: true
358 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
359 | variablePattern: '[a-z][A-Za-z0-9]*'
360 | privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
361 | excludeClassPattern: '$^'
362 | ignoreOverridden: true
363 |
364 | performance:
365 | active: true
366 | ArrayPrimitive:
367 | active: false
368 | ForEachOnRange:
369 | active: true
370 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
371 | SpreadOperator:
372 | active: true
373 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
374 | UnnecessaryTemporaryInstantiation:
375 | active: true
376 |
377 | potential-bugs:
378 | active: true
379 | DuplicateCaseInWhenExpression:
380 | active: true
381 | EqualsAlwaysReturnsTrueOrFalse:
382 | active: false
383 | EqualsWithHashCodeExist:
384 | active: true
385 | ExplicitGarbageCollectionCall:
386 | active: true
387 | InvalidRange:
388 | active: false
389 | IteratorHasNextCallsNextMethod:
390 | active: false
391 | IteratorNotThrowingNoSuchElementException:
392 | active: false
393 | LateinitUsage:
394 | active: false
395 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
396 | excludeAnnotatedProperties: ""
397 | ignoreOnClassesPattern: ""
398 | MissingWhenCase:
399 | active: false
400 | RedundantElseInWhen:
401 | active: false
402 | UnconditionalJumpStatementInLoop:
403 | active: false
404 | UnreachableCode:
405 | active: true
406 | UnsafeCallOnNullableType:
407 | active: false
408 | UnsafeCast:
409 | active: false
410 | UselessPostfixExpression:
411 | active: false
412 | WrongEqualsTypeParameter:
413 | active: false
414 |
415 | style:
416 | active: true
417 | CollapsibleIfStatements:
418 | active: false
419 | DataClassContainsFunctions:
420 | active: false
421 | conversionFunctionPrefix: 'to'
422 | DataClassShouldBeImmutable:
423 | active: false
424 | EqualsNullCall:
425 | active: false
426 | EqualsOnSignatureLine:
427 | active: false
428 | ExplicitItLambdaParameter:
429 | active: false
430 | ExpressionBodySyntax:
431 | active: false
432 | includeLineWrapping: false
433 | ForbiddenComment:
434 | active: true
435 | values: 'TODO:,FIXME:,STOPSHIP:'
436 | ForbiddenImport:
437 | active: false
438 | imports: ''
439 | ForbiddenVoid:
440 | active: false
441 | ignoreOverridden: false
442 | ignoreUsageInGenerics: false
443 | FunctionOnlyReturningConstant:
444 | active: false
445 | ignoreOverridableFunction: true
446 | excludedFunctions: 'describeContents'
447 | LibraryCodeMustSpecifyReturnType:
448 | active: false
449 | LoopWithTooManyJumpStatements:
450 | active: false
451 | maxJumpCount: 1
452 | MagicNumber:
453 | active: true
454 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
455 | ignoreNumbers: '-1,0,1,2'
456 | ignoreHashCodeFunction: true
457 | ignorePropertyDeclaration: false
458 | ignoreConstantDeclaration: true
459 | ignoreCompanionObjectPropertyDeclaration: true
460 | ignoreAnnotation: false
461 | ignoreNamedArgument: true
462 | ignoreEnums: false
463 | ignoreRanges: false
464 | MandatoryBracesIfStatements:
465 | active: false
466 | MaxLineLength:
467 | active: true
468 | maxLineLength: 120
469 | excludePackageStatements: true
470 | excludeImportStatements: true
471 | excludeCommentStatements: false
472 | MayBeConst:
473 | active: false
474 | ModifierOrder:
475 | active: true
476 | NestedClassesVisibility:
477 | active: false
478 | NewLineAtEndOfFile:
479 | active: true
480 | NoTabs:
481 | active: false
482 | OptionalAbstractKeyword:
483 | active: true
484 | OptionalUnit:
485 | active: false
486 | OptionalWhenBraces:
487 | active: false
488 | PreferToOverPairSyntax:
489 | active: false
490 | ProtectedMemberInFinalClass:
491 | active: false
492 | RedundantVisibilityModifierRule:
493 | active: false
494 | ReturnCount:
495 | active: true
496 | max: 2
497 | excludedFunctions: "equals"
498 | excludeLabeled: false
499 | excludeReturnFromLambda: true
500 | SafeCast:
501 | active: true
502 | SerialVersionUIDInSerializableClass:
503 | active: false
504 | SpacingBetweenPackageAndImports:
505 | active: false
506 | ThrowsCount:
507 | active: true
508 | max: 2
509 | TrailingWhitespace:
510 | active: false
511 | UnderscoresInNumericLiterals:
512 | active: false
513 | acceptableDecimalLength: 5
514 | UnnecessaryAbstractClass:
515 | active: false
516 | excludeAnnotatedClasses: "dagger.Module"
517 | UnnecessaryApply:
518 | active: false
519 | UnnecessaryInheritance:
520 | active: false
521 | UnnecessaryLet:
522 | active: false
523 | UnnecessaryParentheses:
524 | active: false
525 | UntilInsteadOfRangeTo:
526 | active: false
527 | UnusedImports:
528 | active: false
529 | UnusedPrivateClass:
530 | active: false
531 | UnusedPrivateMember:
532 | active: false
533 | allowedNames: "(_|ignored|expected|serialVersionUID)"
534 | UseCheckOrError:
535 | active: false
536 | UseDataClass:
537 | active: false
538 | excludeAnnotatedClasses: ""
539 | UseRequire:
540 | active: false
541 | UselessCallOnNotNull:
542 | active: false
543 | UtilityClassWithPublicConstructor:
544 | active: false
545 | VarCouldBeVal:
546 | active: false
547 | WildcardImport:
548 | active: true
549 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
550 | excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
551 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_forem_bot.xml:
--------------------------------------------------------------------------------
1 |
6 |
11 |
12 |
13 |
16 |
21 |
22 |
26 |
29 |
34 |
39 |
42 |
47 |
50 |
55 |
60 |
65 |
68 |
69 |
70 |
73 |
74 |
77 |
80 |
84 |
85 |
88 |
91 |
92 |
96 |
97 |
100 |
103 |
104 |
108 |
109 |
112 |
115 |
116 |
121 |
126 |
131 |
132 |
133 |
136 |
137 |
138 |
141 |
142 |
145 |
148 |
153 |
154 |
157 |
162 |
166 |
167 |
170 |
173 |
174 |
177 |
182 |
186 |
187 |
190 |
193 |
194 |
198 |
203 |
206 |
211 |
216 |
220 |
225 |
228 |
233 |
238 |
243 |
248 |
249 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------