From: insang-hmogara-pc Date: Mon, 14 Sep 2026 06:30:14 +0000 (+0900) Subject: initialize X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=fb07c094a038dde18022939f86c2f542c2c0109d;p=BbosooniShare.git initialize --- fb07c094a038dde18022939f86c2f542c2c0109d diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..bcf4711 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..5785373 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/deviceManager.xml b/.idea/deviceManager.xml new file mode 100644 index 0000000..91f9558 --- /dev/null +++ b/.idea/deviceManager.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..02c4aa5 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..29a5cc0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..80cffe7 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace = "com.example.bbosoonishare" + compileSdk { + version = release(37) + } + + defaultConfig { + applicationId = "com.example.bbosoonishare" + minSdk = 24 + targetSdk = 37 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + optimization { + enable = false + } + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +dependencies { + implementation(libs.androidx.activity.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.constraintlayout) + implementation(libs.androidx.core.ktx) + implementation(libs.material) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(libs.androidx.junit) +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/bbosoonishare/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/bbosoonishare/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..6d65e3d --- /dev/null +++ b/app/src/androidTest/java/com/example/bbosoonishare/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.bbosoonishare + +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.example.bbosoonishare", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d27f14c --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..687b752 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/example/bbosoonishare/MainActivity.kt b/app/src/main/java/com/example/bbosoonishare/MainActivity.kt new file mode 100644 index 0000000..074047d --- /dev/null +++ b/app/src/main/java/com/example/bbosoonishare/MainActivity.kt @@ -0,0 +1,201 @@ +package com.example.bbosoonishare + +import android.content.Intent +import android.graphics.Color +import android.graphics.drawable.GradientDrawable +import android.os.Bundle +import android.util.Log +import android.view.Gravity +import android.view.View +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import java.net.HttpURLConnection +import java.net.URL +import java.net.URLEncoder +import java.util.concurrent.Executors + +class MainActivity : AppCompatActivity() { + + companion object { + private const val TAG = "BbosooniShare" + private const val BOT_TOKEN = "8914900331:AAEdhtIBWlIY0q2Ic1jyS8nzhFeD_E6fF_U" + private const val CHAT_ID = "8963021716" + } + + private val executor = Executors.newSingleThreadExecutor() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + Log.d(TAG, "========== onCreate ==========") + Log.d(TAG, "action = ${intent?.action}") + Log.d(TAG, "type = ${intent?.type}") + Log.d(TAG, "text = ${intent?.getStringExtra(Intent.EXTRA_TEXT)}") + + setContentView(R.layout.activity_main) + + if (intent?.action == Intent.ACTION_SEND) { + Log.d(TAG, "ACTION_SEND → handleShareIntent()") + handleShareIntent(intent) + } else { + Log.d(TAG, "ACTION_SEND 아님 → 종료") + showToast("이 앱은 네이버지도 공유 기능에서만 사용할 수 있습니다.") + finishAndRemoveTask() + } + } + + private fun handleShareIntent(intent: Intent) { + Log.d(TAG, "========== handleShareIntent ==========") + Log.d(TAG, "intent.type = ${intent.type}") + + if (intent.type != "text/plain") { + Log.d(TAG, "text/plain 아님 → 종료") + showErrorAndFinish() + return + } + + val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT) + + Log.d(TAG, "sharedText = $sharedText") + + if (sharedText.isNullOrBlank()) { + Log.d(TAG, "sharedText 없음 → 종료") + showErrorAndFinish() + return + } + + if (!sharedText.contains("https://naver.me/", ignoreCase = true)) { + Log.d(TAG, "naver.me 없음 → 종료") + showErrorAndFinish() + return + } + + Log.d(TAG, "naver.me 확인 → 확인창 표시") + showConfirmDialog(sharedText) + } + + private fun showConfirmDialog(text: String) { + Log.d(TAG, "========== showConfirmDialog ==========") + + val confirmView = findViewById(R.id.confirmView) + val cancelButton = findViewById(R.id.cancelButton) + val sendButton = findViewById(R.id.sendButton) + + confirmView.visibility = View.VISIBLE + + cancelButton.setOnClickListener { + Log.d(TAG, "취소 버튼 클릭 → 종료") + finishAndRemoveTask() + } + + sendButton.setOnClickListener { + Log.d(TAG, "전송 버튼 클릭") + Log.d(TAG, "전송할 text = $text") + confirmView.visibility = View.GONE + sendToTelegram(text) + } + } + + private fun sendToTelegram(text: String) { + Log.d(TAG, "========== sendToTelegram ==========") + Log.d(TAG, "Telegram 전송 시작") + + findViewById(R.id.processView).visibility = View.VISIBLE + + executor.execute { + var connection: HttpURLConnection? = null + + try { + val encodedText = URLEncoder.encode(text, "UTF-8") + val url = URL("https://api.telegram.org/bot$BOT_TOKEN/sendMessage?chat_id=$CHAT_ID&text=$encodedText") + + Log.d(TAG, "URL 생성 완료") + + connection = url.openConnection() as HttpURLConnection + connection.requestMethod = "GET" + connection.connectTimeout = 10000 + connection.readTimeout = 10000 + + Log.d(TAG, "Telegram 연결 시작") + + val responseCode = connection.responseCode + + Log.d(TAG, "Telegram responseCode = $responseCode") + + runOnUiThread { + if (responseCode in 200..299) { + Log.d(TAG, "전송 성공 → showSuccess()") + showSuccess() + } else { + Log.d(TAG, "전송 실패 → responseCode = $responseCode") + showToast("전송에 실패했습니다.") + finishAndRemoveTask() + } + } + } catch (e: Exception) { + Log.e(TAG, "Telegram 전송 예외", e) + + runOnUiThread { + showToast("전송에 실패했습니다.") + finishAndRemoveTask() + } + } finally { + connection?.disconnect() + Log.d(TAG, "Telegram 연결 종료") + } + } + } + + private fun showSuccess() { + Log.d(TAG, "========== showSuccess ==========") + + val progressBar = findViewById(R.id.progressBar) + val checkMark = findViewById(R.id.checkMark) + val processText = findViewById(R.id.processText) + + progressBar.visibility = View.GONE + checkMark.visibility = View.VISIBLE + processText.text = "전송되었습니다." + + Log.d(TAG, "성공 화면 표시 → 900ms 후 종료") + + window.decorView.postDelayed({ + Log.d(TAG, "900ms 경과 → finishAndRemoveTask()") + finishAndRemoveTask() + }, 900) + } + + private fun showErrorAndFinish() { + Log.d(TAG, "========== showErrorAndFinish ==========") + showToast("네이버지도의 장소나 경로만 공유할 수 있습니다.") + finishAndRemoveTask() + } + + private fun showToast(message: String) { + Log.d(TAG, "Toast = $message") + + val toast = Toast(this) + val textView = TextView(this) + + textView.text = message + textView.textSize = 16f + textView.setTextColor(Color.WHITE) + textView.setPadding(32, 20, 32, 20) + textView.background = GradientDrawable().apply { + setColor(Color.argb(235, 35, 35, 35)) + cornerRadius = 24f + } + + toast.view = textView + toast.duration = Toast.LENGTH_SHORT + toast.setGravity(Gravity.CENTER, 0, 0) + toast.show() + } + + override fun onDestroy() { + Log.d(TAG, "========== onDestroy ==========") + executor.shutdownNow() + super.onDestroy() + } +} \ No newline at end of file diff --git a/app/src/main/keepRules/rules.keep b/app/src/main/keepRules/rules.keep new file mode 100644 index 0000000..d7e081a --- /dev/null +++ b/app/src/main/keepRules/rules.keep @@ -0,0 +1,12 @@ +# Add project specific R8 rules here. +# AGP will combine all keep rule files in src/main/keepRules to pass to R8 +# +# For more details, see +# https://d.android.com/r/tools/r8/keep-rules + +# 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 *; +#} \ No newline at end of file diff --git a/app/src/main/res/drawable/confirm_background.xml b/app/src/main/res/drawable/confirm_background.xml new file mode 100644 index 0000000..6b05904 --- /dev/null +++ b/app/src/main/res/drawable/confirm_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/process_background.xml b/app/src/main/res/drawable/process_background.xml new file mode 100644 index 0000000..f8c7879 --- /dev/null +++ b/app/src/main/res/drawable/process_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..ab4d42e --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..65291b9 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..65291b9 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..a537c10 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..31b2490 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..8cbf9b7 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..a1a5271 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..db943bc Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..7054f91 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..77f0ee1 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..9e3daf9 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..2d1e671 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..316e603 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..533158e Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1a95770 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..5f61e21 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..27916fc Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..cd69e83 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..0eec9cf --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..c8524cd --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..4e823a0 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #3DDC84 + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..f55ccc8 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + BbosooniShare + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..a38d699 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + + +