Skip to content

Commit

Permalink
ADST-47 (#324)
Browse files Browse the repository at this point in the history
* fixed crash

* optimize error handling

* add more sceanrio to error handling

* linked search screen

* added folder search screen

* get result from folder search
  • Loading branch information
aman-alfresco authored Apr 1, 2024
1 parent 2777b85 commit a99b18a
Show file tree
Hide file tree
Showing 50 changed files with 593 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class ProcessDefinitionsSheet : BottomSheetDialogFragment(), MavericksView {

val intent = Intent(
requireActivity(),
Class.forName("com.alfresco.content.process.ui.ProcessFormActivity"),
Class.forName("com.alfresco.content.app.activity.ProcessActivity"),
// Class.forName("com.alfresco.content.process.ui.ProcessFormActivity"),
)
intent.putExtra(Mavericks.KEY_ARG, processEntry)
startActivity(intent)
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ dependencies {
implementation project(':viewer')
implementation project(':shareextension')
implementation project(':move')

implementation project(':process-app')
implementation project(':data')
implementation libs.alfresco.content

Expand All @@ -122,6 +122,7 @@ dependencies {
implementation libs.coil.core
implementation libs.gson
implementation libs.compose.runtime
implementation libs.constraintlayout

coreLibraryDesugaring libs.android.desugar

Expand Down
14 changes: 8 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<application
Expand All @@ -13,10 +14,13 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:useEmbeddedDex="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Alfresco">
android:theme="@style/Theme.Alfresco"
android:useEmbeddedDex="true">
<activity
android:name=".activity.ProcessActivity"
android:exported="false" />
<activity
android:name=".activity.ExtensionActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize"
Expand Down Expand Up @@ -79,12 +83,10 @@
<activity
android:name=".activity.MoveActivity"
android:windowSoftInputMode="adjustNothing" />

<activity
android:name="com.alfresco.content.app.activity.TaskViewerActivity"
android:name=".activity.TaskViewerActivity"
android:configChanges="orientation|screenSize"
android:exported="false" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.alfresco.content.app.activity

import android.os.Bundle
import androidx.navigation.fragment.NavHostFragment
import com.airbnb.mvrx.MavericksView
import com.alfresco.content.app.R
import com.alfresco.content.app.databinding.ActivityProcessBinding
import com.alfresco.content.app.widget.ActionBarController
import com.alfresco.content.app.widget.ActionBarLayout
import com.alfresco.content.common.BaseActivity

class ProcessActivity : BaseActivity(), MavericksView {

private lateinit var binding: ActivityProcessBinding
private lateinit var actionBarController: ActionBarController

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityProcessBinding.inflate(layoutInflater)
setContentView(binding.root)
configureNav()
}

private fun configureNav() {
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
val navController = navHostFragment.navController
val inflater = navController.navInflater
val graph = inflater.inflate(R.navigation.nav_process_paths)
navController.setGraph(graph, intent.extras)
val actionBarLayout = findViewById<ActionBarLayout>(R.id.toolbar)
actionBarController = ActionBarController(actionBarLayout)
actionBarController.setupActionBar(this, navController)

actionBarLayout.toolbar.setNavigationOnClickListener { onBackPressed() }
}

override fun invalidate() {
}
}
25 changes: 25 additions & 0 deletions app/src/main/res/layout/activity_process.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<include layout="@layout/layout_toolbar" />

<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:defaultNavHost="true" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/white"
android:backgroundTint="?attr/separatorColor" />

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.alfresco.content.actions.Action
import com.alfresco.content.browse.R
import com.alfresco.content.browse.databinding.ActivityLocalPreviewBinding
import com.alfresco.content.data.Entry
import com.alfresco.content.process.ui.fragments.BaseDetailFragment.Companion.KEY_ENTRY_OBJ
import com.alfresco.content.process.ui.fragments.ProcessBaseFragment.Companion.KEY_ENTRY_OBJ

/**
* Mark as Preview Activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.alfresco.content.browse.tasks.detail.TaskDetailViewState
import com.alfresco.content.data.AnalyticsManager
import com.alfresco.content.data.Entry
import com.alfresco.content.data.EventName
import com.alfresco.content.process.ui.fragments.BaseDetailFragment.Companion.KEY_ENTRY_OBJ
import com.alfresco.content.process.ui.fragments.ProcessBaseFragment.Companion.KEY_ENTRY_OBJ
import com.alfresco.content.viewer.ViewerActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.alfresco.content.data.PageView
import com.alfresco.content.data.ParentEntry
import com.alfresco.content.data.UploadServerType
import com.alfresco.content.mimetype.MimeType
import com.alfresco.content.process.ui.fragments.BaseDetailFragment.Companion.KEY_ENTRY_OBJ
import com.alfresco.content.process.ui.fragments.ProcessBaseFragment.Companion.KEY_ENTRY_OBJ
import com.alfresco.content.simpleController
import com.alfresco.ui.getDrawableForAttribute

Expand Down
4 changes: 2 additions & 2 deletions browse/src/main/res/navigation/nav_task_paths.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
<fragment
android:id="@+id/nav_attached_files"
android:name="com.alfresco.content.browse.tasks.attachments.AttachedFilesFragment"
tools:layout="@layout/fragment_attached_files" />
tools:layout="@layout/fragment_attach_files" />

<fragment
android:id="@+id/nav_process_attached_files"
android:name="com.alfresco.content.browse.processes.attachments.ProcessAttachedFilesFragment"
tools:layout="@layout/fragment_attached_files" />
tools:layout="@layout/fragment_attach_files" />

<fragment
android:id="@+id/nav_process_details"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ fun NavController.navigateToContextualSearch(id: String, title: String, isExtens
}
}

/**
* navigate to contextual search from process app
*/
fun NavController.navigateToContextualSearch(title: String, isProcess: Boolean) {
navigate(Uri.parse("$BASE_URI/search/folder?title=${Uri.encode(title)},process=$isProcess"))
}

/**
* navigate to browse parent folder
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ interface EntryListener {
* It will get called on tap of start workflow on the option list
*/
fun onProcessStart(entries: List<ParentEntry>) {}

fun onAttachFolder(entry: ParentEntry) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ data class DatePickerBuilder(
timePicker.addOnPositiveButtonClickListener {
val hour = timePicker.hour
val minute = timePicker.minute
println("string date $stringDateTime || $hour || $minute")
val combinedDateTime = "$stringDateTime $hour:$minute"
onSuccess?.invoke(combinedDateTime)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.alfresco.content.data

data class AttachFolderSearchData(val entry: Entry? = null)
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ enum class FieldType {
FUNCTIONAL_GROUP,
HYPERLINK,
UPLOAD,
SELECT_FOLDER,
;

fun value() = name.lowercase()
Expand Down
6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ test = "1.5.0"
activity-compose = "1.7.0"
compose-bom = "2023.10.01"
ui-tooling = "1.5.4"
appcompat = "1.6.1"
material = "1.11.0"
constraintlayout = "2.1.4"

[libraries]
alfresco-auth = "com.alfresco.android:auth:0.8.1-SNAPSHOT"
Expand Down Expand Up @@ -133,4 +136,7 @@ ui-compose-viewbinding = "androidx.compose.ui:ui-viewbinding:1.6.3"
navigation-compose = "androidx.navigation:navigation-compose:2.7.6"
compose-runtime = "androidx.compose.runtime:runtime:1.5.4"
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "ui-tooling" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }

8 changes: 0 additions & 8 deletions move/src/main/java/com/alfresco/content/move/MoveFragment.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.alfresco.content.move

import android.content.Context
import android.os.Bundle
import android.os.Parcelable
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -46,14 +45,8 @@ class MoveFragment : Fragment(), MavericksView {
@OptIn(InternalMavericksApi::class)
val viewModel: MoveViewModel by fragmentViewModelWithArgs { args }

override fun onAttach(context: Context) {
super.onAttach(context)
println("MoveFragment.onAttach")
}

override fun onStart() {
super.onStart()
println("MoveFragment.onStart")
val nodeId = viewModel.getMyFilesNodeId()
args.entryObj?.let {
findNavController().navigateToMoveParent(nodeId, it.id, getString(R.string.browse_menu_personal))
Expand All @@ -62,7 +55,6 @@ class MoveFragment : Fragment(), MavericksView {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
println("MoveFragment.onCreate")
args = MoveArgs.with(requireArguments())
}

Expand Down
1 change: 1 addition & 0 deletions process-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {
implementation project(':viewer-text')
implementation project(':viewer')
implementation project(':mimetype')
implementation project(':search')

implementation libs.androidx.core
implementation libs.androidx.appcompat
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.alfresco.content.process.ui.components
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import com.alfresco.content.data.payloads.FieldsData
import com.alfresco.content.process.ui.utils.inputField

@Composable
fun AmountInputField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.alfresco.content.data.Entry
import com.alfresco.content.data.payloads.FieldsData
import com.alfresco.content.process.R
import com.alfresco.content.process.ui.composeviews.NavigationScreen
import com.alfresco.content.process.ui.theme.AlfrescoBlue300
import com.alfresco.content.process.ui.theme.AlfrescoError

Expand All @@ -37,6 +37,7 @@ fun AttachFilesField(
contents: List<Entry> = emptyList(),
fieldsData: FieldsData = FieldsData(),
navController: NavController,
errorData: Pair<Boolean, String> = Pair(false, ""),
) {
val labelWithAsterisk = buildAnnotatedString {
append(fieldsData.name)
Expand Down Expand Up @@ -72,7 +73,7 @@ fun AttachFilesField(

IconButton(onClick = {
navController.navigate(
NavigationScreen.ATTACHED_FILES_SCREEN.value(),
R.id.action_nav_process_form_to_nav_attach_files,
)
}) {
Icon(
Expand All @@ -98,5 +99,5 @@ fun AttachFilesField(
@Preview
@Composable
fun AttachFilesFieldPreview() {
// AttachFilesField()
AttachFilesField(navController = rememberNavController())
}
Loading

0 comments on commit a99b18a

Please sign in to comment.