Skip to content

Commit

Permalink
[CHORE] #1 - Initial Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mdb1217 committed May 21, 2022
1 parent f1b6c0c commit 737ea9f
Show file tree
Hide file tree
Showing 52 changed files with 1,122 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
91 changes: 91 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import Versions.javaVersion
import org.apache.tools.ant.util.JavaEnvUtils.VERSION_11

plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
id("dagger.hilt.android.plugin")
}

android {
compileSdk = Constants.compileSdk
buildToolsVersion = "30.0.3"

defaultConfig {
applicationId = Constants.packageName
minSdk = Constants.minSdk
targetSdk = Constants.targetSdk
versionCode = Constants.versionCode
versionName = Constants.versionName

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}

kotlinOptions {
jvmTarget = "11"
}

buildFeatures {
dataBinding = true
viewBinding = true
}
}

dependencies {
// Kotlin
implementation(KotlinDependencies.kotlin)

// Android Core
implementation(AndroidXDependencies.coreKtx)
implementation(AndroidXDependencies.appCompat)
implementation(AndroidXDependencies.constraintLayout)
implementation(AndroidXDependencies.coroutines)

// Material Design
implementation(MaterialDesignDependencies.materialDesign)

// Dagger-Hilt
implementation(AndroidXDependencies.hilt)
implementation("androidx.appcompat:appcompat:1.4.1")
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
kapt(KaptDependencies.hiltCompiler)

// Jetpack Security
implementation(AndroidXDependencies.security)

// Jetpack Fragment
implementation(AndroidXDependencies.fragment)

// Jetpack Lifecycle
implementation(AndroidXDependencies.coroutines)
implementation(AndroidXDependencies.lifeCycleKtx)
implementation(AndroidXDependencies.lifecycleJava8)

// ImageLoading Library
// Glide for general
implementation(ThirdPartyDependencies.glide)
kapt(KaptDependencies.glideCompiler)

// Http Client Library
implementation(ThirdPartyDependencies.retrofit)
implementation(platform(ThirdPartyDependencies.okHttpBom))
implementation(ThirdPartyDependencies.okHttp)
implementation(ThirdPartyDependencies.okHttpLoggingInterceptor)

// Gson
implementation(ThirdPartyDependencies.gson)

// Logger - Timber
implementation(ThirdPartyDependencies.timber)

// Test Dependency
testImplementation(TestDependencies.androidTest)
testImplementation(TestDependencies.jUnit)
}
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.kts.
#
# 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 org.sopt.sopkathon5.andorid

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("org.sopt.sopkathon5.andorid", appContext.packageName)
}
}
27 changes: 27 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.sopt.sopkathon5.andorid" >

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AndoridClient"
tools:targetApi="31" >
<activity
android:name=".ui.MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.sopt.sopkathon5.andorid.data

import retrofit2.Retrofit

object ServiceCreator {
private const val BASE_URL = "https://asia-northeast3-we-sopt-29.cloudfunctions.net/api/"

private val retrofit: Retrofit = Retrofit
.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
12 changes: 12 additions & 0 deletions app/src/main/java/org/sopt/sopkathon5/andorid/ui/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.sopt.sopkathon5.andorid.ui

import android.os.Bundle
import org.sopt.sopkathon5.andorid.R
import org.sopt.sopkathon5.andorid.databinding.ActivityMainBinding
import org.sopt.sopkathon5.andorid.util.base.BaseActivity

class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
23 changes: 23 additions & 0 deletions app/src/main/java/org/sopt/sopkathon5/andorid/util/EnqueueUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.sopt.sopkathon5.andorid.util

import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

fun <responseType> Call<responseType>.customEnqueue(
Success: (Response<responseType>) -> Unit,
Fail: () -> Unit = {}
) {
this.enqueue(object : Callback<responseType> {
override fun onFailure(call: Call<responseType>, t: Throwable) {
Fail()
}

override fun onResponse(call: Call<responseType>, response: Response<responseType>) {
if (response.isSuccessful) {
Success(response)
return
}
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.sopt.sopkathon5.andorid.util.base

import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

abstract class BaseActivity<T : ViewDataBinding>(
@LayoutRes private val layoutRes: Int
) : AppCompatActivity() {
protected lateinit var binding: T

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, layoutRes)
binding.lifecycleOwner = this
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.sopt.sopkathon5.andorid.util.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment

abstract class BaseFragment<T : ViewDataBinding>(
@LayoutRes private val layoutRes: Int
) : Fragment() {
private var _binding: T? = null
protected val binding: T
get() = requireNotNull(_binding)

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = DataBindingUtil.inflate(inflater, layoutRes, container, false)
binding.lifecycleOwner = viewLifecycleOwner
return binding.root
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}
Loading

0 comments on commit 737ea9f

Please sign in to comment.