-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/apple
- Loading branch information
Showing
13 changed files
with
261 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,33 +2,37 @@ name: Android CI | |
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
branches: [ "develop" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: gradle | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
- name: Build debug APK | ||
run: ./gradlew assembleDebug | ||
- name: Upload APK | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: app | ||
path: app/build/outputs/apk/debug | ||
apk: | ||
name: Generate APK | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: gradle | ||
- name: Build debug APK | ||
run: bash ./gradlew assembleDebug --stacktrace | ||
|
||
- name: Upload APK | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: app | ||
path: app/build/outputs/apk/debug | ||
|
||
- name: Slack - Upload APK | ||
uses: MeilCli/[email protected] | ||
with: | ||
slack_token: ${{ secrets.SLACK_TOKEN }} | ||
channels: ${{ secrets.SLACK_CHANNEL }} | ||
initial_comment: 'APK File Upload' | ||
file_path: 'app/build/outputs/apk/debug/app-debug.apk' | ||
file_name: 'app-debug.apk' | ||
file_type: 'apk' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="initial-scale=1.0"> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body> | ||
<p> | ||
로딩이 완료된 웹뷰 입니다. | ||
</p> | ||
|
||
<input type="button" value="Say hello" onClick="showAndroidToast('Hello Black Jin World!')"/> | ||
<script type="text/javascript"> | ||
function showAndroidToast(toast) { | ||
Android.showToast(toast); | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.dogdduddy.jmt.utils | ||
|
||
import android.os.Build | ||
import android.util.DisplayMetrics | ||
import androidx.fragment.app.Fragment | ||
|
||
val Fragment.deviceMetrics | ||
get() = run { | ||
|
||
val displayMetrics = DisplayMetrics() | ||
|
||
// target version above 30 | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
|
||
val windowManager = requireActivity().windowManager | ||
|
||
// target version above 31 | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
|
||
val metrics = windowManager.currentWindowMetrics | ||
metrics.bounds.also { bounds -> | ||
displayMetrics.widthPixels = bounds.width() | ||
displayMetrics.heightPixels = bounds.height() | ||
} | ||
} else { | ||
val display = requireActivity().display | ||
display?.getRealMetrics(displayMetrics) | ||
} | ||
|
||
} else { | ||
requireActivity().windowManager.defaultDisplay?.getMetrics(displayMetrics) | ||
} | ||
displayMetrics | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
app/src/main/java/com/dogdduddy/jmt/view/JmtConfirmDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.dogdduddy.jmt.view | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.DialogFragment | ||
import com.dogdduddy.jmt.R | ||
import com.dogdduddy.jmt.databinding.JmtConfirmDialogBinding | ||
import com.dogdduddy.jmt.utils.deviceMetrics | ||
|
||
class JmtConfirmDialog(private val context: Context) : DialogFragment() { | ||
|
||
private var _binding: JmtConfirmDialogBinding? = null | ||
private val binding | ||
get() = _binding ?: run { | ||
_binding = LayoutInflater.from(context).let { | ||
JmtConfirmDialogBinding.inflate(it) | ||
} | ||
_binding!! | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
super.onCreateView(inflater, container, savedInstanceState) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
dialog?.window?.setBackgroundDrawableResource(R.drawable.jmt_confirm_dialog_background) | ||
isCancelable = false | ||
|
||
binding.confirmButton.setOnClickListener { | ||
dismiss() | ||
} | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
|
||
val displayMetrics = deviceMetrics | ||
|
||
val displayWidth = displayMetrics.widthPixels | ||
val displayHeight = displayMetrics.heightPixels | ||
|
||
val dialogWindowWidth = (displayWidth * 0.9f).toInt() | ||
val dialogWindowHeight = (displayHeight * 0.25f).toInt() | ||
|
||
dialog?.window?.setLayout(dialogWindowWidth, dialogWindowHeight) | ||
} | ||
|
||
fun setTitle(title: String): JmtConfirmDialog { | ||
binding.titleText.text = title | ||
return this | ||
} | ||
|
||
fun setContent(content: String): JmtConfirmDialog { | ||
binding.contentText.text = content | ||
return this | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
|
||
companion object { | ||
const val TAG = "JmtConfirmDialog" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/dogdduddy/jmt/view/WebAppInterface.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.dogdduddy.jmt.view | ||
|
||
import android.content.Context | ||
import android.webkit.JavascriptInterface | ||
import android.widget.Toast | ||
|
||
/** Instantiate the interface and set the context */ | ||
class WebAppInterface(private val mContext: Context) { | ||
|
||
/** Show a toast from the web page */ | ||
@JavascriptInterface | ||
fun showToast(toast: String) { | ||
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/white" /> | ||
<corners android:radius="20dp" /> | ||
</shape> |
9 changes: 9 additions & 0 deletions
9
app/src/main/res/drawable/jmt_confirm_dialog_button_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:color="@color/main800"> | ||
<item> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="@color/main600" /> | ||
<corners android:radius="8dp" /> | ||
</shape> | ||
</item> | ||
</ripple> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:id="@+id/title_text" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="74.5dp" | ||
android:layout_marginTop="24dp" | ||
android:gravity="center_horizontal" | ||
android:textSize="18sp" | ||
android:textColor="@color/black" | ||
android:textStyle="bold" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
tools:text="회원가입을 할 수 없습니다"/> | ||
|
||
<TextView | ||
android:id="@+id/content_text" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:gravity="center_horizontal" | ||
android:textSize="14sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/title_text" | ||
tools:text="와이파이 연결상태를\n 다시 확인해주세요."/> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/confirm_button" | ||
android:text="@string/confirm" | ||
android:textSize="20sp" | ||
android:layout_width="0dp" | ||
android:layout_height="62dp" | ||
android:layout_marginHorizontal="27.5dp" | ||
android:layout_marginTop="24dp" | ||
android:background="@drawable/jmt_confirm_dialog_button_background" | ||
app:backgroundTint="#20BC2F" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/content_text" | ||
tools:text="확인"/> | ||
<Space | ||
android:layout_width="wrap_content" | ||
android:layout_height="24dp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/confirm_button"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters