Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Convert whole project to Kotlin and modernize code.
Browse files Browse the repository at this point in the history
  • Loading branch information
afollestad committed Nov 26, 2018
1 parent c06349f commit 6a19c07
Show file tree
Hide file tree
Showing 92 changed files with 3,330 additions and 3,147 deletions.
24 changes: 7 additions & 17 deletions .travis.yml
Expand Up @@ -3,30 +3,20 @@ jdk: oraclejdk8
android:
components:
- tools
- build-tools-25.0.3
- android-25
- platform-tools
- build-tools-28.0.3
- android-28
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository

# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
# - platform-tools
# - tools

# The BuildTools version used by your project
#- build-tools-23.0.2

# The SDK version used to compile your project
#- android-23

# Additional components
#- extra-google-google_play_services
#- extra-google-m2repository
#- extra-android-m2repository
#- addon-google_apis-google-19

# Specify at least one system image,
# if you need to run emulator(s) during your tests
# Specify at least one system image, if you need to run emulator(s) during your tests
#- sys-img-armeabi-v7a-android-19
#- sys-img-x86-android-17

licenses:
- '.+'
2 changes: 1 addition & 1 deletion LICENSE.md
Expand Up @@ -64,7 +64,7 @@ While redistributing the Work or Derivative Works thereof, You may choose to off

To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.

### Copyright 2016 Aidan Follestad
### Copyright 2018 Aidan Follestad

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Expand Down
71 changes: 39 additions & 32 deletions app/build.gradle
@@ -1,43 +1,50 @@
apply from: '../dependencies.gradle'
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools

lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.afollestad.photoaffix"
minSdkVersion 21
targetSdkVersion 25
versionCode 25
versionName "0.6.2 BETA"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
defaultConfig {
applicationId "com.afollestad.photoaffix"
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode versions.publishVersionCode
versionName versions.publishVersion
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:' + versions.kotlin
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:' + versions.coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:' + versions.coroutines

implementation 'androidx.appcompat:appcompat:' + versions.androidx

compile 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.google.dagger:dagger:' + versions.dagger
kapt 'com.google.dagger:dagger-compiler:' + versions.dagger

compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.chrisbanes:PhotoView:1.3.1'
implementation 'com.github.bumptech.glide:glide:' + versions.glide

implementation 'com.afollestad.material-dialogs:core:' + versions.materialDialogs
implementation 'com.afollestad.material-dialogs:color:' + versions.materialDialogs
implementation 'com.afollestad:drag-select-recyclerview:' + versions.dragSelectRv
implementation 'com.afollestad:assent:' + versions.assent
}

compile 'com.afollestad.material-dialogs:core:0.9.4.5'
compile 'com.afollestad.material-dialogs:commons:0.9.4.5'
compile 'com.afollestad:inquiry:5.0.0'
compile 'com.afollestad:drag-select-recyclerview:0.3.6'
}
apply from: '../spotless.gradle'
41 changes: 18 additions & 23 deletions app/src/main/AndroidManifest.xml
@@ -1,18 +1,21 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.afollestad.photoaffix">
xmlns:tools="http://schemas.android.com/tools"
package="com.afollestad.photoaffix">

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

<application
android:allowBackup="true"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".ui.MainActivity">
android:name=".App"
android:allowBackup="true"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<activity android:name=".activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand All @@ -25,24 +28,16 @@
</intent-filter>
</activity>

<activity
android:name=".ui.ViewerActivity"
android:theme="@style/AppTheme.Black"/>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>

<meta-data
android:name="io.fabric.ApiKey"
android:value="e9b2b6339277beb481a9c658b72cd0e4c714e0cb"/>

</application>

</manifest>
21 changes: 21 additions & 0 deletions app/src/main/java/com/afollestad/photoaffix/App.kt
@@ -0,0 +1,21 @@
/*
* Licensed under Apache-2.0
*
* Designed and developed by Aidan Follestad (@afollestad)
*/
package com.afollestad.photoaffix

import android.app.Application

/** @author Aidan Follestad (afollestad) */
class App : Application() {

lateinit var appComponent: AppComponent

override fun onCreate() {
super.onCreate()
appComponent = DaggerAppComponent.builder()
.application(this)
.build()
}
}
28 changes: 28 additions & 0 deletions app/src/main/java/com/afollestad/photoaffix/AppComponent.kt
@@ -0,0 +1,28 @@
/*
* Licensed under Apache-2.0
*
* Designed and developed by Aidan Follestad (@afollestad)
*/
package com.afollestad.photoaffix

import android.app.Application
import com.afollestad.photoaffix.activities.MainActivity
import dagger.BindsInstance
import dagger.Component
import javax.inject.Singleton

/** @author Aidan Follestad (afollestad) */
@Singleton
@Component(modules = [AppModule::class])
interface AppComponent {

fun inject(mainActivity: MainActivity)

@Component.Builder
interface Builder {

@BindsInstance fun application(application: Application): Builder

fun build(): AppComponent
}
}
27 changes: 27 additions & 0 deletions app/src/main/java/com/afollestad/photoaffix/AppModule.kt
@@ -0,0 +1,27 @@
/*
* Licensed under Apache-2.0
*
* Designed and developed by Aidan Follestad (@afollestad)
*/
package com.afollestad.photoaffix

import com.afollestad.photoaffix.data.PhotoLoader
import com.afollestad.photoaffix.data.RealPhotoLoader
import com.afollestad.photoaffix.presenters.AffixPresenter
import com.afollestad.photoaffix.presenters.RealAffixPresenter
import dagger.Binds
import dagger.Module
import javax.inject.Singleton

/** @author Aidan Follestad (afollestad) */
@Module
abstract class AppModule {

@Binds
@Singleton
abstract fun providePhotoLoader(realPhotoLoader: RealPhotoLoader): PhotoLoader

@Binds
@Singleton
abstract fun provideAffixPresenter(affixer: RealAffixPresenter): AffixPresenter
}

0 comments on commit 6a19c07

Please sign in to comment.