Skip to content

Commit

Permalink
Merge pull request #1 from 0queue/the-long-awaited-2020-update
Browse files Browse the repository at this point in the history
The long awaited 2020 update
  • Loading branch information
0queue authored Dec 30, 2020
2 parents 68a1052 + 11b9485 commit 17b6795
Show file tree
Hide file tree
Showing 115 changed files with 1,714 additions and 838 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.iml
.gradle
/local.properties
/.idea/caches
Expand All @@ -10,7 +9,6 @@
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

# Created by .ignore support plugin (hsz.mobi)
Expand Down
31 changes: 31 additions & 0 deletions THOUGHTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,34 @@ generation, so I hacked it to use `"username" + i.to_s` instead of the Faker
thing and it worked (spitting out tons of warnings from the cops of course).

At least after all that `rails server` worked like a charm, so that's nice.

## The Great 2020 Refresh

The big update went rather smoothly, considering how long a year is in Android Time,
no non trivial code changes had to be made, and except for the weird exception in
[buildSrc/build.gradle.kts](buildSrc/build.gradle.kts), Kotlin is nice and up to date.

To reflect on some earlier technology choices:

- Still glad I chose to go with Conductor. Between easy transitions and straightforward
backstack manipulation, I feel like it hits the right balance of correct defaults
for simple situations, and power for making sure every edge case works as desired. As long
as I continue to work with Views and anything above a few screens, I feel like I will reach
for Conductor. That said, I should maybe upstream something about the view lifecycle, because
as Fragment folks have already figured out, the view lifecycle and controller lifecycle are
different, and I don't believe conductor has that built in yet.

- SQLDelight/Coroutines/Retrofit makes data loading easy and straightforward: Just observe the
database, and when refresh events happen, hop off the main thread, download, and insert. For
paging, the Paging library does a lot of magic that means I pretty much just need a "load a page"
method, but I don't know how necessary that magic is. A nice future experiment would be to have a
list of observed pages that get rendered in the adapter, then observe more pages as the user
scrolls.

- Multi module navigation is still something of a question mark to me, in such a small app my
approach of manual reflection is aggressively okay, not fun to write but very contained and
theoretically easy to test. I may revisit this in the future if I think of/hear about any
better approaches.

Overall, I used Claw at least daily for the whole year before this refresh, with only one unknown
crash (and one known crash, due to lobste.rs changes), and look forward to another year of stability.
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ plugins {
}

android.defaultConfig.applicationId = "dev.thomasharris.claw"
// not sure why this is needed
android.packagingOptions.pickFirst("META-INF/kotlinx-coroutines-core.kotlin_module")

dependencies {
implementation(project(":core"))
// keep these as implementation so that build variant switching in android studio works properly
implementation(project(":feature-front-page"))
implementation(project(":feature-comments"))
implementation(project(":feature-settings"))
implementation(project(":feature-web-page"))
implementation(project(":feature-user-profile"))

debugImplementation("com.squareup.leakcanary:leakcanary-android:2.4")
}
debugRuntimeOnly("com.squareup.leakcanary:leakcanary-android:2.6")
}
19 changes: 6 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".core.MainActivity">
<activity
android:name=".core.MainActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -28,23 +30,14 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<!-- handle http[s]://lobste.rs[/.*] and let the app decide what to do -->
<data
android:host="lobste.rs"
android:scheme="https" />
<data android:scheme="http" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="lobste.rs"
android:pathPrefix="/s"
android:pathPattern=".*"
android:scheme="https" />
</intent-filter>
<!-- NOTE: If a new intent filter is added, make sure MainActivity routes correctly -->
</activity>
</application>

Expand Down
34 changes: 0 additions & 34 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml

This file was deleted.

170 changes: 0 additions & 170 deletions app/src/main/res/drawable/ic_launcher_background.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

This file was deleted.

Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
25 changes: 12 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import dev.thomasharris.claw.build.NewModuleTask

plugins {
id("com.github.ben-manes.versions") version "0.28.0"
id("com.github.ben-manes.versions") version "0.36.0"
id("org.jlleitschuh.gradle.ktlint") version "9.4.1"
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
// ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()

}
dependencies {
classpath("com.android.tools.build:gradle:4.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

classpath("com.squareup.sqldelight:gradle-plugin:1.4.0")
classpath("com.github.ben-manes:gradle-versions-plugin:0.28.0")
dependencies {
classpath("com.android.tools.build:gradle:4.1.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21")
classpath("com.squareup.sqldelight:gradle-plugin:1.4.4")
classpath("com.github.ben-manes:gradle-versions-plugin:0.36.0")
}
}

Expand All @@ -31,8 +26,12 @@ allprojects {
}
}

subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
}

tasks.register("clean", Delete::class.java) {
delete(rootProject.buildDir)
}

tasks.register("newModule", NewModuleTask::class.java)
tasks.register("newModule", NewModuleTask::class.java)
Loading

0 comments on commit 17b6795

Please sign in to comment.