Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bentrengrove committed Mar 18, 2020
0 parents commit 2bf8a1d
Show file tree
Hide file tree
Showing 61 changed files with 1,810 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.DS_Store

# generated files
bin/
gen/
captures/

# Local configuration file (sdk path, etc)
local.properties

# Android Studio
.idea/
.gradle
local.properties
build/
*.iml
*.iws
*.ipr


### fastlane ###
# fastlane - A streamlined workflow tool for Cocoa deployment

# fastlane specific
fastlane/report.xml

# deliver temporary files
fastlane/Preview.html

# snapshot generated screenshots
fastlane/screenshots/**/*.png
fastlane/screenshots/screenshots.html

# scan temporary files
fastlane/test_output
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
68 changes: 68 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.apollographql.apollo'
apply plugin: 'androidx.navigation.safeargs.kotlin'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

defaultConfig {
applicationId "com.bentrengrove.projectexplorer"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField "String", "GITHUB_TOKEN", github_token
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
}

apollo {
generateKotlinModels.set(true) // or false for Java models
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.apollographql.apollo:apollo-runtime:1.3.3"
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.1'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation "io.noties.markwon:core:4.2.2"

// If not already on your classpath, you might need the jetbrains annotations
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0'
compileOnly "org.jetbrains:annotations:13.0"
testCompileOnly "org.jetbrains:annotations:13.0"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.bentrengrove.projectexplorer

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.bentrengrove.projectexplorer", appContext.packageName)
}
}
25 changes: 25 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bentrengrove.projectexplorer">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:name=".MyApplication"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
35 changes: 35 additions & 0 deletions app/src/main/graphql/com/bentrengrove/project.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
query ProjectQuery($owner: String!, $name: String!, $number: Int!, $limit: Int!){
repository(owner: $owner, name: $name) {
project(number: $number) {
columns(first: $limit) {
totalCount
nodes {
id
name
cards(first: $limit) {
nodes {
id
note
content {
... on Issue {
title
body
url
}
... on PullRequest {
title
body
url
}
}
state
creator {
login
}
}
}
}
}
}
}
}
14 changes: 14 additions & 0 deletions app/src/main/graphql/com/bentrengrove/projects.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
query ProjectsQuery($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
id
name
projects(first: 5) {
totalCount
nodes {
id
name
number
}
}
}
}
15 changes: 15 additions & 0 deletions app/src/main/graphql/com/bentrengrove/repositories.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
query RepositoriesQuery($limit: Int!) {
viewer {
name
repositories(last: $limit) {
nodes {
id
name
owner {
login
}
openGraphImageUrl
}
}
}
}
1 change: 1 addition & 0 deletions app/src/main/graphql/com/bentrengrove/schema.json

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions app/src/main/java/com/bentrengrove/projectexplorer/Data.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.bentrengrove.projectexplorer

import com.apollographql.apollo.ApolloClient
import com.facebook.stetho.okhttp3.StethoInterceptor
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Request

object Data {
private val httpClient = OkHttpClient.Builder()
.addInterceptor { chain: Interceptor.Chain ->
val original: Request = chain.request()
val builder: Request.Builder =
original.newBuilder().method(original.method(), original.body())
builder.header("Authorization", "bearer ${BuildConfig.GITHUB_TOKEN}")
chain.proceed(builder.build())
}
.addNetworkInterceptor(StethoInterceptor())
.build()

val apolloClient: ApolloClient = ApolloClient.builder()
.serverUrl("https://api.github.com/graphql")
.okHttpClient(httpClient)
.build()
}
25 changes: 25 additions & 0 deletions app/src/main/java/com/bentrengrove/projectexplorer/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.bentrengrove.projectexplorer

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupWithNavController
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlin.coroutines.CoroutineContext

class MainActivity : AppCompatActivity(), CoroutineScope {
override val coroutineContext: CoroutineContext
get() = Dispatchers.Main

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val navController = findNavController(R.id.nav_host_fragment)
val appBarConfiguration = AppBarConfiguration(navController.graph)
toolbar.setupWithNavController(navController, appBarConfiguration)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.bentrengrove.projectexplorer

import android.app.Application
import com.facebook.stetho.Stetho

class MyApplication: Application() {
override fun onCreate() {
super.onCreate()
Stetho.initializeWithDefaults(this)
}
}
Loading

0 comments on commit 2bf8a1d

Please sign in to comment.