Skip to content

Commit

Permalink
#1274 use build flavor source directory rather than gradle module
Browse files Browse the repository at this point in the history
  • Loading branch information
sds100 committed Aug 13, 2024
1 parent b353671 commit aa9986f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "pro"]
path = pro
[submodule "app/src/pro"]
path = app/src/pro
url = https://github.com/keymapperorg/KeyMapperPro
10 changes: 9 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ android {
viewBinding true
aidl true
buildConfig true
compose true
}

compileOptions {
Expand All @@ -105,6 +106,10 @@ android {
kapt {
correctErrorTypes = true
}

composeOptions {
kotlinCompilerExtensionVersion "1.5.10"
}
}

android.sourceSets {
Expand All @@ -129,7 +134,6 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

compileOnly project(':systemstubs')
proImplementation project(":pro")

def room_version = "2.6.1"
def coroutinesVersion = "1.5.0"
Expand Down Expand Up @@ -195,6 +199,10 @@ dependencies {
implementation "androidx.core:core-splashscreen:1.0.1"
kapt "androidx.room:room-compiler:$room_version"

// Compose
implementation 'androidx.compose.ui:ui-android:1.6.8'
implementation 'androidx.compose.material3:material3-android:1.2.1'

// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'

def junitVersion = "4.13.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.github.sds100.keymapper.mappings.assistant

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.fragment.app.Fragment
import io.github.sds100.keymapper.databinding.FragmentComposeViewBinding

class AssistantTriggerFragment : Fragment() {
private var _binding: FragmentComposeViewBinding? = null

private val binding get() = _binding!!

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentComposeViewBinding.inflate(inflater, container, false)
val view = binding.root
binding.composeView.apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
MaterialTheme {
Text("I am free build variant.")
}
}
}

return view
}

override fun onDestroyView() {
_binding = null
super.onDestroyView()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package io.github.sds100.keymapper.home
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import io.github.sds100.keymapper.R
import io.github.sds100.keymapper.mappings.assistant.AssistantTriggerFragment
import io.github.sds100.keymapper.mappings.fingerprintmaps.FingerprintMapListFragment
import io.github.sds100.keymapper.mappings.keymaps.KeyMapListFragment
import io.github.sds100.keymapperpro.AssistantTriggerFragment

/**
* Created by sds100 on 26/01/2020.
Expand Down Expand Up @@ -45,9 +45,7 @@ class HomePagerAdapter(

HomeTab.ASSISTANT_TRIGGER -> {
{
AssistantTriggerFragment().apply {
isAppBarVisible = false
}
AssistantTriggerFragment()
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/res/layout/fragment_compose_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
include ':app'
include ':systemstubs'
include ':pro'

0 comments on commit aa9986f

Please sign in to comment.