Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: set up JDK 1.8
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 8
java-version: 17
distribution: 'temurin'
cache: gradle

Expand Down
61 changes: 33 additions & 28 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'de.mobilej.unmock'
apply plugin: 'com.getkeepsafe.dexcount'
Expand All @@ -20,6 +20,7 @@ repositories {
}

android {
namespace "org.ligi.gobandroid_hd"
flavorDimensions "analytics", "cloud", "autostart"

productFlavors {
Expand Down Expand Up @@ -48,7 +49,7 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
Expand All @@ -64,15 +65,14 @@ android {

}

compileSdkVersion 30
buildToolsVersion '29.0.3'
compileSdkVersion 36

defaultConfig {
versionCode 260
versionCode 262
versionName "2.6.0"
minSdkVersion 21
targetSdkVersion 33
applicationId "org.ligi.gobandroid_hd"
targetSdkVersion 36
applicationId "org.icehong.gobandroid_hd"
testInstrumentationRunner "org.ligi.gobandroid_hd.AppReplacingRunner"
archivesBaseName = "Gobandroid-$versionName"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -117,58 +117,63 @@ android {
minifyEnabled false
}
}
buildFeatures {
viewBinding true
buildConfig true
aidl true
}
} // android

configurations {
all {
configureEach {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
}

dependencies {
implementation "com.github.permissions-dispatcher:permissionsdispatcher:4.8.0"
kapt "com.github.permissions-dispatcher:permissionsdispatcher-processor:4.8.0"
implementation "com.github.permissions-dispatcher:permissionsdispatcher:4.9.2"
kapt "com.github.permissions-dispatcher:permissionsdispatcher-processor:4.9.2"
implementation 'com.github.salomonbrys.kodein:kodein:4.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'com.github.ligi:KAXT:1.0'
implementation 'com.github.ligi:tracedroid:4.1'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.jakewharton.timber:timber:5.0.1'

implementation 'com.github.ligi.snackengage:snackengage-playrate:0.27'
implementation 'com.github.ligi:ExtraCompats:1.0'
implementation 'jchardet:jchardet:1.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp:5.3.0'
implementation 'com.n3twork.druid:alphanum:1.0.3'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.annotation:annotation:1.9.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.chibatching.kotpref:kotpref:$kotpref_version"
implementation "com.chibatching.kotpref:initializer:$kotpref_version"
withAnalyticsImplementation "com.google.android.gms:play-services-analytics:17.0.0"
withCloudImplementation "com.google.android.gms:play-services-games:19.0.0"
withAnalyticsImplementation "com.google.android.gms:play-services-analytics:18.0.2"
withCloudImplementation "com.google.android.gms:play-services-games:23.1.0"
withCloudImplementation "com.google.android.gms:play-services-plus:17.0.0"
withCloudImplementation "com.google.android.gms:play-services-gcm:17.0.0"
withCloudImplementation('com.google.apis:google-api-services-games:v1-rev98-1.20.0') {
exclude module: 'jsr305'
}
androidTestImplementation 'androidx.test:runner:1.5.1'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:2.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test:rules:1.7.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'com.github.ligi:trulesk:4.3'
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
androidTestImplementation 'androidx.annotation:annotation:1.9.1'
androidTestImplementation 'com.squareup.assertj:assertj-android:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
testImplementation 'com.squareup.assertj:assertj-android:1.2.0'
testImplementation 'androidx.annotation:annotation:1.1.0'
testImplementation 'androidx.annotation:annotation:1.9.1'
testImplementation 'junit:junit:4.13.2'

implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'org.greenrobot:eventbus:3.3.1'

}
2 changes: 2 additions & 0 deletions android/proguard-project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@
-dontwarn org.conscrypt.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

-dontwarn com.google.protobuf.java_com_google_android_gmscore_sdk*
3 changes: 1 addition & 2 deletions android/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
package="org.ligi.gobandroid_hd">
<manifest xmlns:tools="http://schemas.android.com/tools">

<uses-sdk tools:overrideLibrary="com.jraska.falcon.spooncompat , com.jraska.falcon"/>

Expand Down
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.ligi.gobandroid_hd"

android:installLocation="auto">

<supports-screens
Expand All @@ -12,6 +10,7 @@
android:smallScreens="true" />

<!-- Permission to keep the screen awake -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
package org.ligi.gobandroid_hd.ui

import android.os.Bundle
import kotlinx.android.synthetic.withCloud.profile.*
import org.ligi.gobandroid_hd.R
import org.ligi.gobandroid_hd.databinding.ProfileBinding
import org.ligi.gobandroid_hd.ui.application.GobandroidFragmentActivity

class BaseProfileActivity : GobandroidFragmentActivity() {

private lateinit var binding: ProfileBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.profile)
binding = ProfileBinding.bind(pbinding.contentFrame.getChildAt(0))

setTitle(R.string.profile)

supportActionBar?.setDisplayShowTitleEnabled(true)

rank_edit.setText(GoPrefs.rank)
username_edit.setText(GoPrefs.username)
binding.rankEdit.setText(GoPrefs.rank)
binding.usernameEdit.setText(GoPrefs.username)
}


override fun onPause() {
GoPrefs.rank = rank_edit.text.toString()
GoPrefs.username = username_edit.text.toString()
GoPrefs.rank = binding.rankEdit.text.toString()
GoPrefs.username = binding.usernameEdit.text.toString()
super.onPause()
}

Expand Down
55 changes: 29 additions & 26 deletions android/src/main/java/org/ligi/gobandroid_hd/ui/CustomActionBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,29 @@ import androidx.appcompat.app.AlertDialog
import androidx.core.content.res.ResourcesCompat
import com.github.salomonbrys.kodein.instance
import com.github.salomonbrys.kodein.lazy
import kotlinx.android.synthetic.main.dropdown_item.view.*
import kotlinx.android.synthetic.main.top_nav_and_extras.view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.ligi.gobandroid_hd.App
import org.ligi.gobandroid_hd.InteractionScope
import org.ligi.gobandroid_hd.InteractionScope.Mode.*
import org.ligi.gobandroid_hd.InteractionScope.Mode.COUNT
import org.ligi.gobandroid_hd.InteractionScope.Mode.EDIT
import org.ligi.gobandroid_hd.InteractionScope.Mode.GNUGO
import org.ligi.gobandroid_hd.InteractionScope.Mode.RECORD
import org.ligi.gobandroid_hd.InteractionScope.Mode.REVIEW
import org.ligi.gobandroid_hd.InteractionScope.Mode.SETUP
import org.ligi.gobandroid_hd.InteractionScope.Mode.TELEVIZE
import org.ligi.gobandroid_hd.InteractionScope.Mode.TSUMEGO
import org.ligi.gobandroid_hd.R
import org.ligi.gobandroid_hd.databinding.DropdownItemBinding
import org.ligi.gobandroid_hd.databinding.TopNavAndExtrasBinding
import org.ligi.gobandroid_hd.events.GameChangedEvent
import org.ligi.gobandroid_hd.model.GameProvider
import org.ligi.gobandroid_hd.ui.gnugo.GnuGoHelper
import org.ligi.gobandroid_hd.ui.ingame_common.SwitchModeHelper
import timber.log.Timber

class CustomActionBar(private val activity: Activity) : LinearLayout(activity) {
private var binding: TopNavAndExtrasBinding

private val GooglePlayStorePackageNameOld = "com.google.market"
private val GooglePlayStorePackageNameNew = "com.android.vending"
Expand All @@ -40,6 +48,7 @@ class CustomActionBar(private val activity: Activity) : LinearLayout(activity) {
private val highlightColor: Int = ResourcesCompat.getColor(resources, R.color.dividing_color, null)
private val transparent: Int = ResourcesCompat.getColor(resources, android.R.color.transparent, null)


override fun onAttachedToWindow() {
super.onAttachedToWindow()
EventBus.getDefault().register(this)
Expand All @@ -51,29 +60,23 @@ class CustomActionBar(private val activity: Activity) : LinearLayout(activity) {
}

init {

inflater.inflate(R.layout.top_nav_and_extras, this)
binding = TopNavAndExtrasBinding.inflate(inflater,this,true)

refresh()

mode_tv.setOnClickListener {
binding.modeTv.setOnClickListener {
showModePopup(activity)
}

move_tv.setOnClickListener {
binding.moveTv.setOnClickListener {
showModePopup(activity)
}


}

private fun addItem(container: LinearLayout, image_resId: Int, str_resid: Int, listener: Runnable) {

val v = inflater.inflate(R.layout.dropdown_item, container, false)
v.text.setText(str_resid)
v.image.setImageResource(image_resId)
v.click_container.setOnClickListener { listener.run() }
container.addView(v)
val bd = DropdownItemBinding.inflate(inflater,container,false)
bd.text.setText(str_resid)
bd.image.setImageResource(image_resId)
bd.clickContainer.setOnClickListener { listener.run() }
container.addView(bd.root)
}

private fun addModeItem(container: LinearLayout, mode: InteractionScope.Mode, string_res: Int, icon_res: Int, pop: BetterPopupWindow) {
Expand Down Expand Up @@ -106,7 +109,7 @@ class CustomActionBar(private val activity: Activity) : LinearLayout(activity) {

private fun showModePopup(ctx: Context) {

val pop = BetterPopupWindow(mode_tv)
val pop = BetterPopupWindow(binding.modeTv)

val scrollView = ScrollView(ctx)
val contentView = LinearLayout(ctx)
Expand Down Expand Up @@ -153,22 +156,22 @@ class CustomActionBar(private val activity: Activity) : LinearLayout(activity) {
post {
val actMode = interactionScope.mode

mode_tv.setText(actMode.getStringRes())
binding.modeTv.setText(actMode.getStringRes())

val game = gameProvider.get()

white_captures_tv.text = game.capturesWhite.toString()
black_captures_tv.text = game.capturesBlack.toString()
binding.whiteCapturesTv.text = game.capturesWhite.toString()
binding.blackCapturesTv.text = game.capturesBlack.toString()

val isWhitesMove = !game.isBlackToMove && !game.isFinished
white_info_container.setBackgroundColor(if (isWhitesMove) highlightColor else transparent)
white_captures_tv.setBackgroundColor(if (isWhitesMove) highlightColor else transparent)
binding.whiteInfoContainer.setBackgroundColor(if (isWhitesMove) highlightColor else transparent)
binding.whiteCapturesTv.setBackgroundColor(if (isWhitesMove) highlightColor else transparent)

val isBlacksMove = game.isBlackToMove || game.isFinished
blackStoneImageView.setBackgroundColor(if (isBlacksMove) highlightColor else transparent)
black_captures_tv.setBackgroundColor(if (isBlacksMove) highlightColor else transparent)
binding.blackStoneImageView.setBackgroundColor(if (isBlacksMove) highlightColor else transparent)
binding.blackCapturesTv.setBackgroundColor(if (isBlacksMove) highlightColor else transparent)

move_tv.text = app.resources.getString(R.string.move) + game.actMove.movePos
binding.moveTv.text = app.resources.getString(R.string.move) + game.actMove.movePos
}
}

Expand Down
Loading
Loading