Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Hyperion-Android #672

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ dependencies {
//==================== Debug ====================
debugImplementation(Depends.Stetho.core)
debugImplementation(Depends.Stetho.okhttp3)
listOf(Depends.Hyperion.core,
Depends.Hyperion.measurement,
Depends.Hyperion.attr,
Depends.Hyperion.disk,
Depends.Hyperion.recorder,
Depends.Hyperion.phoenix,
Depends.Hyperion.crash,
Depends.Hyperion.preferences,
Depends.Hyperion.simpleItem
).forEach {
debugImplementation(it) {
exclude(group = "com.android.support")
exclude(group = "com.google.dagger")
}
}

implementation(Depends.crashlytics) {
isTransitive = true
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package io.github.droidkaigi.confsched2018.presentation

import android.content.Context
import android.content.ContextWrapper
import android.support.v4.app.FragmentActivity
import com.facebook.stetho.Stetho
import com.github.takahirom.hyperion.plugin.simpleitem.SimpleItem
import com.github.takahirom.hyperion.plugin.simpleitem.SimpleItemHyperionPlugin
import com.squareup.leakcanary.LeakCanary
import com.tomoima.debot.Debot
import com.tomoima.debot.DebotConfigurator
import com.tomoima.debot.DebotStrategyBuilder
import io.github.droidkaigi.confsched2018.R
import timber.log.Timber

class DebugApp : App() {
Expand All @@ -14,6 +21,24 @@ class DebugApp : App() {
setupLeakCanary()
setupStetho()
setupDebot()
setupHyperion()
}

private fun setupHyperion() {
val item = SimpleItem.Builder("Depot menu")
.image(R.drawable.ic_notification)
.clickListener { view ->
fun unwrapFragmentActivity(context: Context): FragmentActivity? {
if (context is FragmentActivity) return context
Copy link
Contributor

@jmatsu jmatsu Apr 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MUST: return if context is null

Ah sorry, this was wrong!

val baseContext = (context as? ContextWrapper)?.baseContext ?: return null
return unwrapFragmentActivity(baseContext)
}

val activity: FragmentActivity? = unwrapFragmentActivity(view.context)
?: return@clickListener
Debot.getInstance().showDebugMenu(activity)
}.build()
SimpleItemHyperionPlugin.addItem(item)
}

private fun setupTimber() {
Expand All @@ -34,6 +59,5 @@ class DebugApp : App() {
.build()

DebotConfigurator.configureWithCustomizedMenu(builder.strategyList)
registerActivityLifecycleCallbacks(DebotObserver())
}
}
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ allprojects {
jcenter()
maven(url="https://plugins.gradle.org/m2/")
maven(url="https://maven.fabric.io/public")
maven(url = "https://maven.fabric.io/public")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dup

maven(url = "https://jitpack.io")
}
}

Expand Down
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/Depends.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ object Depends {
val okhttp3 = "com.facebook.stetho:stetho-okhttp3:${Versions.stetho}"
}

object Hyperion {
val core = "com.willowtreeapps.hyperion:hyperion-core:${Versions.hyperion}"
val measurement = "com.willowtreeapps.hyperion:hyperion-measurement:${Versions.hyperion}"
val attr = "com.willowtreeapps.hyperion:hyperion-attr:${Versions.hyperion}"
val disk = "com.willowtreeapps.hyperion:hyperion-disk:${Versions.hyperion}"
val recorder = "com.willowtreeapps.hyperion:hyperion-recorder:${Versions.hyperion}"
val phoenix = "com.willowtreeapps.hyperion:hyperion-phoenix:${Versions.hyperion}"
val crash = "com.willowtreeapps.hyperion:hyperion-crash:${Versions.hyperion}"
val preferences = "com.willowtreeapps.hyperion:hyperion-shared-preferences:${Versions.hyperion}"
val simpleItem = "com.github.takahirom:Hyperion-Simple-Item:0.3.0"
}

val crashlytics = "com.crashlytics.sdk.android:crashlytics:2.8.0@aar"
val timber = "com.jakewharton.timber:timber:4.6.0"
val leakcanary = "com.squareup.leakcanary:leakcanary-android:1.5.4"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ object Versions {
const val glide = "4.5.0"
const val groupie = "2.0.3"
const val stetho = "1.5.0"
const val hyperion = "0.9.21"
const val debot = "2.0.3"
const val ossLicenses = "0.9.1"
const val deploygate = "1.1.4"
Expand Down