diff --git a/app/src/main/java/com/ncs/o2/Constants/Endpoints.kt b/app/src/main/java/com/ncs/o2/Constants/Endpoints.kt
index 79610e5d..16ba6f1c 100644
--- a/app/src/main/java/com/ncs/o2/Constants/Endpoints.kt
+++ b/app/src/main/java/com/ncs/o2/Constants/Endpoints.kt
@@ -9,9 +9,10 @@ object Endpoints {
const val APP_CONFIG = "AppConfig"
const val USERID = "userid1"
const val new_changes_des = "Certainly! In order to provide you with a more personalized description, could you please specify what kind of description you are looking for? Are you interested in a description of a person, a place, an event, or something else? Additionally, if you have any specific details or preferences in mind, feel free to share them, so I can tailor the description to your needs.```xml ```"
- const val defaultProject="Oxidizer"
- const val defaultAlias="OXR"
- const val defaultSegment="Getting started"
+ const val defaultProject="None" //Oxidizer
+ const val defaultAlias="None" //OXR
+ const val defaultSegment="Select Segment" //Getting started
+ val defaultSections=listOf("Must Read", "Features", "Working", "Instructions")
const val defaultLightSensi=.1F
const val defaultMediumSensi=1.5F
const val defaultHeavySensi=2.5F
diff --git a/app/src/main/java/com/ncs/o2/HelperClasses/PrefManager.kt b/app/src/main/java/com/ncs/o2/HelperClasses/PrefManager.kt
index f4f419a0..c1a6a1c7 100644
--- a/app/src/main/java/com/ncs/o2/HelperClasses/PrefManager.kt
+++ b/app/src/main/java/com/ncs/o2/HelperClasses/PrefManager.kt
@@ -466,7 +466,7 @@ object PrefManager {
val type = object : TypeToken>() {}.type
return gson.fromJson(sectionsJson, type)
}else{
- return listOf("Must Read", "Features", "Working", "Instructions")
+ return Endpoints.defaultSections
}
}
fun putProjectsList(projects:List){
@@ -669,6 +669,9 @@ object PrefManager {
}
fun setAppMode(mode:String) {
+ if (mode==Endpoints.OFFLINE_MODE){
+ PrefManager.setShakePref(false)
+ }
editor.putString("appMode", mode)
editor.apply()
}
diff --git a/app/src/main/java/com/ncs/o2/UI/MainActivity.kt b/app/src/main/java/com/ncs/o2/UI/MainActivity.kt
index 13683914..44df7afd 100644
--- a/app/src/main/java/com/ncs/o2/UI/MainActivity.kt
+++ b/app/src/main/java/com/ncs/o2/UI/MainActivity.kt
@@ -230,8 +230,39 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
}
+ binding.gioActionbar.refresh.setOnClickThrottleBounceListener {
+ if (PrefManager.getAppMode()==Endpoints.ONLINE_MODE){
+ startActivity(Intent(this,CreateTaskActivity::class.java))
+ }
+ else{
+ easyElements.showSnackbar(binding.root,"Task Creation is not available in offline mode",3000)
+ }
+ }
+ manageNoProject()
+
+ }
+
+ private fun manageNoProject(){
+ if (PrefManager.getcurrentProject()=="None"){
+ binding.projectPlaceholder.visible()
+ binding.navHostFragmentActivityMain.gone()
+ binding.bottomNavParent.gone()
+ binding.gioActionbar.teamsSearch.gone()
+ binding.gioActionbar.notifications.gone()
+ binding.gioActionbar.btnMoreTeams.gone()
+ binding.gioActionbar.searchCont.gone()
+ PrefManager.setRadioButton(-1)
+ }
+ else{
+ binding.navHostFragmentActivityMain.visible()
+ binding.bottomNavParent.visible()
+ binding.gioActionbar.teamsSearch.visible()
+ binding.gioActionbar.notifications.visible()
+ binding.gioActionbar.btnMoreTeams.visible()
+ binding.projectPlaceholder.gone()
+ }
}
private fun initShake(){
@@ -297,10 +328,10 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
// Set up various views and components
setUpProjects()
- setUpActionBar()
setUpViewsOnClicks()
setupProjectsList()
setBottomNavBar()
+ setUpActionBar()
}
@@ -413,6 +444,7 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
override fun onResume() {
super.onResume()
+ manageNoProject()
if (PrefManager.getShakePref()){
initShake()
shakeDetector.registerListener()
@@ -451,9 +483,18 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
}
binding.gioActionbar.btnQuickTask.setOnClickThrottleBounceListener {
- val quickTaskBottomSheet =
- AddQuickTaskBottomSheet(Message(messageId = "", messageType = MessageType.NORMAL_MSG, timestamp = Timestamp.now(), senderId = "", additionalData = emptyMap(), content = ""))
- quickTaskBottomSheet.show(supportFragmentManager, "quickTask")
+ if (PrefManager.getAppMode()==Endpoints.ONLINE_MODE){
+ val quickTaskBottomSheet =
+ AddQuickTaskBottomSheet(Message(messageId = "", messageType = MessageType.NORMAL_MSG, timestamp = Timestamp.now(), senderId = "", additionalData = emptyMap(), content = ""))
+ quickTaskBottomSheet.show(supportFragmentManager, "quickTask")
+ }else {
+
+ easyElements.showSnackbar(
+ binding.root,
+ "Task Creation is not available in offline mode",
+ 3000
+ )
+ }
}
@@ -585,19 +626,31 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
}
private fun setupProjectsList(){
-
+ manageNoProject()
//Version tag setup
binding.drawerheaderfile.versionCode.text = "Oxygen v${getVersionName(this)}"
projects=PrefManager.getProjectsList().toMutableList()
val list=ArrayList()
list.addAll(projects)
+ if (list.contains("None")){
+ list.remove("None")
+ }
val recyclerView=binding.drawerheaderfile.projectRecyclerView
- projectListAdapter = RecyclerViewAdapter(this,list)
- val linearLayoutManager = LinearLayoutManager(this)
- linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
- recyclerView.layoutManager = linearLayoutManager
- recyclerView.adapter = projectListAdapter
+ if (list.isEmpty()){
+ recyclerView.gone()
+ binding.drawerheaderfile.projectPlaceholder.visible()
+ }
+ else{
+ recyclerView.visible()
+ binding.drawerheaderfile.projectPlaceholder.gone()
+ projectListAdapter = RecyclerViewAdapter(this,list)
+ val linearLayoutManager = LinearLayoutManager(this)
+ linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
+ recyclerView.layoutManager = linearLayoutManager
+ recyclerView.adapter = projectListAdapter
+ }
+
}
override fun onClick(projectID: String, position: Int) {
@@ -625,6 +678,8 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
setUpTags(projectName = projectID)
}
+ manageNoProject()
+
}
@@ -829,11 +884,18 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
}
override fun onProjectAdded(userProjects: ArrayList) {
+ manageNoProject()
Log.d("projectCheck",PrefManager.getProjectsList().toString())
PrefManager.putProjectsList(userProjects)
Log.d("projectCheck",PrefManager.getProjectsList().toString())
setupProjectsList()
- projectListAdapter.notifyDataSetChanged()
+ if (this::projectListAdapter.isInitialized) {
+ projectListAdapter.notifyDataSetChanged()
+ }
+ else{
+ projectListAdapter = RecyclerViewAdapter(this,PrefManager.getProjectsList())
+ projectListAdapter.notifyDataSetChanged()
+ }
}
override fun onNewIntent(intent: Intent?) {
@@ -927,10 +989,17 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
}
}
Log.d("position",position.toString())
- PrefManager.setcurrentProject(project)
- PrefManager.setRadioButton(position)
- PrefManager.selectedPosition.value = position
- projectListAdapter.notifyDataSetChanged()
+
+ if (this@MainActivity::projectListAdapter.isInitialized) {
+ PrefManager.setcurrentProject(project)
+ PrefManager.setRadioButton(position)
+ PrefManager.selectedPosition.value = position
+ projectListAdapter.notifyDataSetChanged()
+ }
+ else{
+ projectListAdapter = RecyclerViewAdapter(this@MainActivity,PrefManager.getProjectsList())
+ projectListAdapter.notifyDataSetChanged()
+ }
setupProjectsList()
val intent =
Intent(this@MainActivity, TaskDetailActivity::class.java)
@@ -987,10 +1056,17 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
}
}
Log.d("position",position.toString())
- PrefManager.setcurrentProject(project)
- PrefManager.setRadioButton(position)
- PrefManager.selectedPosition.value = position
- projectListAdapter.notifyDataSetChanged()
+
+ if (this@MainActivity::projectListAdapter.isInitialized) {
+ PrefManager.setcurrentProject(project)
+ PrefManager.setRadioButton(position)
+ PrefManager.selectedPosition.value = position
+ projectListAdapter.notifyDataSetChanged()
+ }
+ else{
+ projectListAdapter = RecyclerViewAdapter(this@MainActivity,PrefManager.getProjectsList())
+ projectListAdapter.notifyDataSetChanged()
+ }
setupProjectsList()
val intent =
Intent(this@MainActivity, TaskDetailActivity::class.java)
@@ -1064,7 +1140,13 @@ class MainActivity : AppCompatActivity(), ProjectCallback,AddProjectBottomSheet.
projects.addAll(result.data)
Timber.tag("result").d(result.data.toString())
PrefManager.putProjectsList(result.data)
- projectListAdapter.notifyDataSetChanged()
+ if (this@MainActivity::projectListAdapter.isInitialized) {
+ projectListAdapter.notifyDataSetChanged()
+ }
+ else{
+ projectListAdapter = RecyclerViewAdapter(this@MainActivity,PrefManager.getProjectsList())
+ projectListAdapter.notifyDataSetChanged()
+ }
setupProjectsList()
CoroutineScope(Dispatchers.IO).launch {
val list = getProjectSegments(PrefManager.getlastaddedproject())
diff --git a/app/src/main/java/com/ncs/o2/UI/NewChanges.kt b/app/src/main/java/com/ncs/o2/UI/NewChanges.kt
index ef16b0fe..74e418c1 100644
--- a/app/src/main/java/com/ncs/o2/UI/NewChanges.kt
+++ b/app/src/main/java/com/ncs/o2/UI/NewChanges.kt
@@ -36,7 +36,7 @@ class NewChanges : AppCompatActivity() {
setViews()
- val desc="## Release Notes [24.1.24] - [24/01/2024]\n" +
+ val desc="## Release Notes [24.2.10] - [10/02/2024]\n" +
"\n" +
"### New Features\n" +
" - Created project stats: Now you can easily track and analyze project statistics within the app.\n" +
@@ -67,7 +67,7 @@ class NewChanges : AppCompatActivity() {
"- Made general improvements in UX\n" +
"\n" +
"### How to Update\n" +
- "- Latest Version of O2 is 24.1.24, it can be downloaded from the release page, find version 24.1.24 at [Release Page](https://github.com/arpitmx/Oxygen/releases)\n" +
+ "- Latest Version of O2 is 24.2.10, it can be downloaded from the release page, find version 24.2.10 at [Release Page](https://github.com/arpitmx/Oxygen/releases)\n" +
"\n" +
"### Feedback\n" +
"- Feedback is the key to enhancing user experience, it is our appeal to the users for providing any constructive feedback about any issues faced by them.\n" +
diff --git a/app/src/main/java/com/ncs/o2/UI/Report/ShakePrefrencesFragment.kt b/app/src/main/java/com/ncs/o2/UI/Report/ShakePrefrencesFragment.kt
index 015c97c2..9ff47d70 100644
--- a/app/src/main/java/com/ncs/o2/UI/Report/ShakePrefrencesFragment.kt
+++ b/app/src/main/java/com/ncs/o2/UI/Report/ShakePrefrencesFragment.kt
@@ -1,5 +1,6 @@
package com.ncs.o2.UI.Report
+import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
@@ -8,6 +9,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import com.ncs.o2.Domain.Utility.ExtensionsUtil.gone
import com.ncs.o2.Domain.Utility.ExtensionsUtil.setOnClickThrottleBounceListener
+import com.ncs.o2.Domain.Utility.ExtensionsUtil.toast
import com.ncs.o2.Domain.Utility.ExtensionsUtil.visible
import com.ncs.o2.Domain.Utility.GlobalUtils
import com.ncs.o2.HelperClasses.PrefManager
@@ -15,6 +17,7 @@ import com.ncs.o2.R
import com.ncs.o2.UI.MainActivity
import com.ncs.o2.databinding.FragmentShakePrefrencesBinding
import com.ncs.o2.databinding.FragmentTeamsBinding
+import com.ncs.versa.Constants.Endpoints
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@@ -72,32 +75,39 @@ class ShakePrefrencesFragment() : Fragment() {
}
binding.simpleSwitch.setOnCheckedChangeListener { buttonView, isChecked ->
- if (isChecked) {
- PrefManager.setShakePref(true)
- binding.shakeControls.visible()
- binding.message.visible()
-
- binding.light.setOnClickThrottleBounceListener{
- PrefManager.setShakeSensitivity(1)
- setUpViews()
- }
- binding.medium.setOnClickThrottleBounceListener{
- PrefManager.setShakeSensitivity(2)
- setUpViews()
-
- }
- binding.heavy.setOnClickThrottleBounceListener{
- PrefManager.setShakeSensitivity(3)
- setUpViews()
+ if (PrefManager.getAppMode()== Endpoints.ONLINE_MODE) {
+ if (isChecked) {
+ PrefManager.setShakePref(true)
+ binding.shakeControls.visible()
+ binding.message.visible()
+
+ binding.light.setOnClickThrottleBounceListener{
+ PrefManager.setShakeSensitivity(1)
+ setUpViews()
+ }
+ binding.medium.setOnClickThrottleBounceListener{
+ PrefManager.setShakeSensitivity(2)
+ setUpViews()
+
+ }
+ binding.heavy.setOnClickThrottleBounceListener{
+ PrefManager.setShakeSensitivity(3)
+ setUpViews()
+
+ }
+
+ } else {
+ PrefManager.setShakePref(false)
+ binding.shakeControls.gone()
+ binding.message.gone()
}
-
- } else {
- PrefManager.setShakePref(false)
- binding.shakeControls.gone()
- binding.message.gone()
-
}
+ else{
+ binding.simpleSwitch.isChecked=false
+ toast("Shake to Report is not available while offline")
+ }
+
}
binding.light.setOnClickThrottleBounceListener{
PrefManager.setShakeSensitivity(1)
diff --git a/app/src/main/java/com/ncs/o2/UI/Setting/SettingsActivity.kt b/app/src/main/java/com/ncs/o2/UI/Setting/SettingsActivity.kt
index c54f5854..a936fc7a 100644
--- a/app/src/main/java/com/ncs/o2/UI/Setting/SettingsActivity.kt
+++ b/app/src/main/java/com/ncs/o2/UI/Setting/SettingsActivity.kt
@@ -69,15 +69,15 @@ class SettingsActivity : AppCompatActivity(), settingAdater.onSettingClick,Netwo
settingOption("Edit Profile", R.drawable.round_edit_24, ""),
settingTitle("what's new"),
- settingOption("What's New", R.drawable.baseline_info_24, "Version 24.1.24"),
+ settingOption("What's New", R.drawable.baseline_info_24, "Version 24.2.10"),
settingTitle("Report & Feedback"),
settingOption("Feedback", R.drawable.baseline_feedback_24, ""),
settingOption("Shake to Report", R.drawable.baseline_screen_rotation_24, ""),
- settingTitle("Logs"),
- settingOption("Logs", R.drawable.baseline_assistant_24, ""),
+// settingTitle("Logs"),
+// settingOption("Logs", R.drawable.baseline_assistant_24, ""),
settingTitle("Account"),
settingOption("Log Out", R.drawable.logout, "") ,
@@ -162,10 +162,16 @@ class SettingsActivity : AppCompatActivity(), settingAdater.onSettingClick,Netwo
this.overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left)
}
else if(Codes.STRINGS.clickedSetting == "Feedback"){
- val intent = Intent(this, ShakeDetectedActivity::class.java)
- intent.putExtra("type", "report")
- startActivity(intent)
- this.overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left)
+ if (PrefManager.getAppMode()== Endpoints.ONLINE_MODE) {
+ val intent = Intent(this, ShakeDetectedActivity::class.java)
+ intent.putExtra("type", "report")
+ startActivity(intent)
+ this.overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left)
+ }
+ else{
+ util.showSnackbar(binding.root,"Feedback can't be given in offline mode",2000)
+ }
+
}
}
diff --git a/app/src/main/java/com/ncs/o2/UI/Tasks/Sections/TaskSectionFragment.kt b/app/src/main/java/com/ncs/o2/UI/Tasks/Sections/TaskSectionFragment.kt
index 7685e24a..535b72b3 100644
--- a/app/src/main/java/com/ncs/o2/UI/Tasks/Sections/TaskSectionFragment.kt
+++ b/app/src/main/java/com/ncs/o2/UI/Tasks/Sections/TaskSectionFragment.kt
@@ -322,7 +322,7 @@ class TaskSectionFragment() : Fragment(), TaskListAdapter.OnClickListener {
val tasks = taskResult.data
if (tasks.isNotEmpty()){
- val newList=taskResult.data.toMutableList().sortedByDescending { it.last_updated }
+ val newList=taskResult.data.toMutableList().sortedByDescending { it.time_STAMP }
PrefManager.setLastTaskTimeStamp(projectName,newList[0].last_updated!!)
for (task in tasks) {
db.tasksDao().insert(task)
@@ -389,7 +389,7 @@ class TaskSectionFragment() : Fragment(), TaskListAdapter.OnClickListener {
val taskadapter = TaskListAdapter(
firestoreRepository,
requireContext(),
- taskItems.sortedByDescending { it.last_updated }.toMutableList(),
+ taskItems.sortedByDescending { it.timestamp }.toMutableList(),
db
)
taskadapter.setOnClickListener(this)
@@ -537,7 +537,7 @@ class TaskSectionFragment() : Fragment(), TaskListAdapter.OnClickListener {
val segment = segments.find { it.segment_NAME == segmentName }
segment?.archived != true
}.toMutableList()
- val sortedList = list.sortedByDescending { it.last_updated }
+ val sortedList = list.sortedByDescending { it.time_STAMP }
return sortedList
}
diff --git a/app/src/main/java/com/ncs/o2/UI/Tasks/TaskPage/Checklist/TaskCheckListFragment.kt b/app/src/main/java/com/ncs/o2/UI/Tasks/TaskPage/Checklist/TaskCheckListFragment.kt
index e7b5ac96..e8b5e2a8 100644
--- a/app/src/main/java/com/ncs/o2/UI/Tasks/TaskPage/Checklist/TaskCheckListFragment.kt
+++ b/app/src/main/java/com/ncs/o2/UI/Tasks/TaskPage/Checklist/TaskCheckListFragment.kt
@@ -157,6 +157,14 @@ class TaskCheckListFragment : Fragment() ,CheckListAdapter.CheckListItemListener
private fun setCheckListRecyclerView(_list: List) {
val list = _list.sortedBy { it.index }.toMutableList()
+ if (list.isEmpty()){
+ binding.noCheckList.visible()
+ checkList_rv.gone()
+ }
+ else{
+ binding.noCheckList.gone()
+ checkList_rv.visible()
+ }
if (isAssignee && !isModerator){
checkListAdapter = CheckListAdapter(list = list,markwon= markwon,this,false,false,true, )
}
@@ -179,7 +187,7 @@ class TaskCheckListFragment : Fragment() ,CheckListAdapter.CheckListItemListener
checkListAdapter = CheckListAdapter(list = list,markwon= markwon,this,false,false,false)
}
val layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
- checkList_rv.visible()
+// checkList_rv.visible()
with(checkList_rv) {
this.layoutManager = layoutManager
adapter = checkListAdapter
diff --git a/app/src/main/java/com/ncs/o2/UI/Teams/TasksHolderActivity.kt b/app/src/main/java/com/ncs/o2/UI/Teams/TasksHolderActivity.kt
index 750c4897..f9323b2f 100644
--- a/app/src/main/java/com/ncs/o2/UI/Teams/TasksHolderActivity.kt
+++ b/app/src/main/java/com/ncs/o2/UI/Teams/TasksHolderActivity.kt
@@ -167,14 +167,14 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
}
"pending"->{
setSelectedColor(binding.pending)
- taskList=taskList.filter { it.status==1 || it.status==2 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==1 || it.status==2 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
}
"working"->{
setSelectedColor(binding.working)
- taskList=taskList.filter { it.status==3 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==3 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
@@ -182,14 +182,14 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
"review"->{
setSelectedColor(binding.review)
- taskList=taskList.filter { it.status==4 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==4 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
}
"completed"->{
setSelectedColor(binding.completed)
- taskList=taskList.filter { it.status==5 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==5 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
@@ -214,13 +214,14 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
setSelectedColor(binding.all)
list.clear()
FetchTasksforModerators()
+ setUpOnSuccessRV(taskList)
}
binding.pending.setOnClickThrottleBounceListener {
viewModel.currentSelected="pending"
setSelectedColor(binding.pending)
val filter = taskList.filter { (it.status == 1 || it.status==2)}.toMutableList()
- setUpOnSuccessRV(filter.sortedByDescending { it.last_updated }.toMutableList())
+ setUpOnSuccessRV(filter.sortedByDescending { it.time_STAMP }.toMutableList())
}
@@ -228,21 +229,21 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
viewModel.currentSelected="working"
setSelectedColor(binding.working)
val filter = taskList.filter { it.status==3}.toMutableList()
- setUpOnSuccessRV(filter.sortedByDescending { it.last_updated }.toMutableList())
+ setUpOnSuccessRV(filter.sortedByDescending { it.time_STAMP }.toMutableList())
}
binding.review.setOnClickThrottleBounceListener {
viewModel.currentSelected="review"
setSelectedColor(binding.review)
val filter = taskList.filter { it.status==4}.toMutableList()
- setUpOnSuccessRV(filter.sortedByDescending { it.last_updated }.toMutableList())
+ setUpOnSuccessRV(filter.sortedByDescending { it.time_STAMP }.toMutableList())
}
binding.completed.setOnClickThrottleBounceListener {
viewModel.currentSelected="completed"
setSelectedColor(binding.completed)
val filter = taskList.filter { it.status==5}.toMutableList()
- setUpOnSuccessRV(filter.sortedByDescending { it.last_updated }.toMutableList())
+ setUpOnSuccessRV(filter.sortedByDescending { it.time_STAMP }.toMutableList())
}
@@ -347,7 +348,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
Log.d("filterActivity", finalFilter.toString())
- setUpOnSuccessRV(finalFilter.sortedByDescending { it.last_updated }.toMutableList())
+ setUpOnSuccessRV(finalFilter.sortedByDescending { it.time_STAMP }.toMutableList())
@@ -563,7 +564,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
taskadapter = TaskListAdapter(
firestoreRepository,
this,
- taskItems.sortedByDescending { it.last_updated }.toMutableList(),
+ taskItems.sortedByDescending { it.timestamp }.toMutableList(),
db
)
taskadapter.setOnClickListener(this)
@@ -611,7 +612,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
is DBResult.Success -> {
taskList.clear()
taskList.addAll(filterTasks(result.data.toMutableList()))
- taskList.sortedByDescending { it.last_updated }
+ taskList.sortedByDescending { it.time_STAMP }
}
@@ -643,7 +644,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
when (result) {
is DBResult.Success -> {
taskList.addAll(filterTasks(result.data.toMutableList()))
- taskList.sortedByDescending { it.last_updated }
+ taskList.sortedByDescending { it.time_STAMP }
}
@@ -675,7 +676,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
is DBResult.Success -> {
taskList.clear()
taskList.addAll(filterTasks(result.data.toMutableList()))
- taskList.sortedByDescending { it.last_updated }
+ taskList.sortedByDescending { it.time_STAMP }
setUpOnSuccessRV(taskList)
@@ -722,7 +723,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
withContext(Dispatchers.Main) {
taskList.clear()
taskList.addAll(filterTasks(list.toMutableList()))
- taskList.sortedByDescending { it.last_updated }
+ taskList.sortedByDescending { it.time_STAMP }
}
}
@@ -783,7 +784,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
when (result) {
is DBResult.Success -> {
taskList.addAll(filterTasks(listOf(result.data)))
- taskList.sortedByDescending { it.last_updated }
+ taskList.sortedByDescending { it.time_STAMP }
}
@@ -906,7 +907,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
performTaskFetch(_type!!)
runDelayed(800) {
binding.results.text = "Matches ${taskList.size} tasks"
- taskadapter.setTasks(taskList.sortedByDescending { it.last_updated }
+ taskadapter.setTasks(taskList.sortedByDescending { it.time_STAMP }
.toMutableList())
taskadapter.notifyDataSetChanged()
}
@@ -924,14 +925,14 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
"pending"->{
setSelectedColor(binding.pending)
- taskList=taskList.filter { it.status==1 || it.status==2 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==1 || it.status==2 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
}
"working"->{
setSelectedColor(binding.working)
- taskList=taskList.filter { it.status==3 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==3 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
@@ -939,14 +940,14 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
"review"->{
setSelectedColor(binding.review)
- taskList=taskList.filter { it.status==4 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==4 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
}
"completed"->{
setSelectedColor(binding.completed)
- taskList=taskList.filter { it.status==5 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==5 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
@@ -978,7 +979,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
"pending"->{
setSelectedColor(binding.pending)
- taskList=taskList.filter { it.status==1 || it.status==2 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==1 || it.status==2 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
@@ -986,21 +987,21 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
"working"->{
setSelectedColor(binding.working)
- taskList=taskList.filter { it.status==3 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==3 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
}
"review"->{
setSelectedColor(binding.review)
- taskList=taskList.filter { it.status==4 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==4 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
}
"completed"->{
setSelectedColor(binding.completed)
- taskList=taskList.filter { it.status==5 }.sortedByDescending { it.last_updated }.toMutableList()
+ taskList=taskList.filter { it.status==5 }.sortedByDescending { it.time_STAMP }.toMutableList()
runDelayed(800) {
searchQuery(binding.searchBar.text.toString())
}
@@ -1022,7 +1023,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
taskList.clear()
performTaskFetch(_type!!)
runDelayed(800){
- setUpOnSuccessRV(taskList.sortedByDescending { it.last_updated }.toMutableList())
+ setUpOnSuccessRV(taskList.sortedByDescending { it.time_STAMP }.toMutableList())
}
}
}
@@ -1296,7 +1297,7 @@ class TasksHolderActivity : AppCompatActivity(),TaskListAdapter.OnClickListener,
val segment = segments.find { it.segment_NAME == segmentName }
segment?.archived != true
}.toMutableList()
- val sortedList = list.sortedByDescending { it.last_updated }
+ val sortedList = list.sortedByDescending { it.time_STAMP }
return sortedList
}
diff --git a/app/src/main/java/com/ncs/o2/UI/Teams/TeamsFragment.kt b/app/src/main/java/com/ncs/o2/UI/Teams/TeamsFragment.kt
index 0728cad9..4d30098d 100644
--- a/app/src/main/java/com/ncs/o2/UI/Teams/TeamsFragment.kt
+++ b/app/src/main/java/com/ncs/o2/UI/Teams/TeamsFragment.kt
@@ -67,7 +67,9 @@ class TeamsFragment : Fragment(), ChannelsAdapter.OnClick, TeamsPagemoreOptions.
savedInstanceState: Bundle?
): View? {
binding = FragmentTeamsBinding.inflate(inflater, container, false)
+
manageviews()
+
return binding.root
}
@@ -82,6 +84,7 @@ class TeamsFragment : Fragment(), ChannelsAdapter.OnClick, TeamsPagemoreOptions.
override fun onResume() {
super.onResume()
+
manageviews()
setUpProjectStats()
val channels=PrefManager.getProjectChannels(PrefManager.getcurrentProject())
@@ -381,39 +384,44 @@ class TeamsFragment : Fragment(), ChannelsAdapter.OnClick, TeamsPagemoreOptions.
}
private fun postDefaultChannel() {
- val channel = Channel(
- channel_name = "General",
- channel_desc = "General Description",
- channel_id = "General${RandomIDGenerator.generateRandomTaskId(4)}",
- timestamp = Timestamp.now(),
- creator = PrefManager.getCurrentUserEmail()
- )
-
- CoroutineScope(Dispatchers.Main).launch {
- repository.postChannel(channel, PrefManager.getcurrentProject()) { result ->
-
- when (result) {
-
- is ServerResult.Failure -> {
- binding.progressBar.gone()
- }
+ if (PrefManager.getcurrentProject()!="None") {
+ val channel = Channel(
+ channel_name = "General",
+ channel_desc = "General Description",
+ channel_id = "General${RandomIDGenerator.generateRandomTaskId(4)}",
+ timestamp = Timestamp.now(),
+ creator = PrefManager.getCurrentUserEmail()
+ )
+
+ CoroutineScope(Dispatchers.Main).launch {
+ repository.postChannel(channel, PrefManager.getcurrentProject()) { result ->
+
+ when (result) {
+
+ is ServerResult.Failure -> {
+ binding.progressBar.gone()
+ }
- ServerResult.Progress -> {
- binding.progressBar.visible()
- }
+ ServerResult.Progress -> {
+ binding.progressBar.visible()
+ }
- is ServerResult.Success -> {
- binding.progressBar.gone()
- val oldList =
- PrefManager.getProjectChannels(PrefManager.getcurrentProject())
- val newList =
- (oldList.toMutableList() + channel).sortedByDescending { it.timestamp }
- PrefManager.saveProjectChannels(PrefManager.getcurrentProject(), newList)
- PrefManager.setLastChannelTimeStamp(
- PrefManager.getcurrentProject(),
- channel.timestamp!!
- )
- setRecyclerView(newList.distinctBy { it.channel_id })
+ is ServerResult.Success -> {
+ binding.progressBar.gone()
+ val oldList =
+ PrefManager.getProjectChannels(PrefManager.getcurrentProject())
+ val newList =
+ (oldList.toMutableList() + channel).sortedByDescending { it.timestamp }
+ PrefManager.saveProjectChannels(
+ PrefManager.getcurrentProject(),
+ newList
+ )
+ PrefManager.setLastChannelTimeStamp(
+ PrefManager.getcurrentProject(),
+ channel.timestamp!!
+ )
+ setRecyclerView(newList.distinctBy { it.channel_id })
+ }
}
}
}
@@ -523,10 +531,6 @@ class TeamsFragment : Fragment(), ChannelsAdapter.OnClick, TeamsPagemoreOptions.
drawerLayout.openDrawer(gravity)
}
- activityBinding.binding.gioActionbar.refresh.setOnClickThrottleBounceListener {
- startActivity(Intent(requireContext(),CreateTaskActivity::class.java))
- }
-
activityBinding.binding.gioActionbar.tabLayout.gone()
activityBinding.binding.gioActionbar.line.visible()
activityBinding.binding.gioActionbar.refresh.visible()
@@ -543,6 +547,14 @@ class TeamsFragment : Fragment(), ChannelsAdapter.OnClick, TeamsPagemoreOptions.
PrefManager.getcurrentProject()
), resources.getDrawable(R.drawable.placeholder_image)
)
+ if (PrefManager.getcurrentProject()=="None"){
+ activityBinding.binding.gioActionbar.btnMoreTeams.gone()
+ activityBinding.binding.gioActionbar.searchCont.gone()
+ }
+ else{
+ activityBinding.binding.gioActionbar.btnMoreTeams.visible()
+ activityBinding.binding.gioActionbar.searchCont.visible()
+ }
}
diff --git a/app/src/main/java/com/ncs/o2/UI/UIComponents/Adapters/TaskListAdapter.kt b/app/src/main/java/com/ncs/o2/UI/UIComponents/Adapters/TaskListAdapter.kt
index d6499d43..612e0619 100644
--- a/app/src/main/java/com/ncs/o2/UI/UIComponents/Adapters/TaskListAdapter.kt
+++ b/app/src/main/java/com/ncs/o2/UI/UIComponents/Adapters/TaskListAdapter.kt
@@ -37,9 +37,7 @@ class TaskListAdapter(val repository: FirestoreRepository,val context: Context,v
private val selectedTags = mutableListOf()
private var onClickListener: OnClickListener? = null
- init {
- taskList.sortedByDescending { it.last_updated }
- }
+
inner class TaskItemViewHolder(private val binding: TaskItemBinding) :
RecyclerView.ViewHolder(binding.root) {
diff --git a/app/src/main/java/com/ncs/o2/UI/UIComponents/BottomSheets/MessageMoreOptions.kt b/app/src/main/java/com/ncs/o2/UI/UIComponents/BottomSheets/MessageMoreOptions.kt
index c27e7fa5..ec2bebda 100644
--- a/app/src/main/java/com/ncs/o2/UI/UIComponents/BottomSheets/MessageMoreOptions.kt
+++ b/app/src/main/java/com/ncs/o2/UI/UIComponents/BottomSheets/MessageMoreOptions.kt
@@ -4,6 +4,7 @@ package com.ncs.o2.UI.UIComponents.BottomSheets
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
+import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@@ -24,9 +25,12 @@ import com.ncs.o2.Domain.Utility.GlobalUtils
import com.ncs.o2.Domain.Utility.NotificationsUtils
import com.ncs.o2.Domain.Utility.RandomIDGenerator
import com.ncs.o2.HelperClasses.PrefManager
+import com.ncs.o2.R
+import com.ncs.o2.UI.Report.ShakeDetectedActivity
import com.ncs.o2.UI.Tasks.TaskPage.Details.TaskDetailsFragment
import com.ncs.o2.UI.Tasks.TaskPage.TaskDetailActivity
import com.ncs.o2.databinding.MsgMoreOptionsBinding
+import com.ncs.versa.Constants.Endpoints
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -88,19 +92,31 @@ class MessageMoreOptions(private val message: com.ncs.o2.Domain.Models.Message,p
}
binding.addtoCheckList.setOnClickThrottleBounceListener {
- val checkList=CheckList(
- id=RandomIDGenerator.generateRandomTaskId(5),
- title = "CheckPoint",
- desc = message.content,
- done = false,
- index = -100)
- addCheckList(checkList)
+ if (PrefManager.getAppMode()== Endpoints.ONLINE_MODE) {
+ val checkList=CheckList(
+ id=RandomIDGenerator.generateRandomTaskId(5),
+ title = "CheckPoint",
+ desc = message.content,
+ done = false,
+ index = -100)
+ addCheckList(checkList)
+ }
+ else{
+ toast("CheckList can't be created while offline")
+ }
+
}
binding.createTask.setOnClickThrottleBounceListener {
- dismiss()
- val addQuickTaskBottomSheet = AddQuickTaskBottomSheet(message,segmentName,sectionName)
- addQuickTaskBottomSheet.show(requireFragmentManager(), "Quick Task")
+ if (PrefManager.getAppMode()== Endpoints.ONLINE_MODE) {
+ dismiss()
+ val addQuickTaskBottomSheet = AddQuickTaskBottomSheet(message,segmentName,sectionName)
+ addQuickTaskBottomSheet.show(requireFragmentManager(), "Quick Task")
+ }
+ else{
+ toast("Task can't be created while offline")
+ }
+
}
binding.copy.setOnClickThrottleBounceListener {
diff --git a/app/src/main/res/layout/actionbar_noproject.xml b/app/src/main/res/layout/actionbar_noproject.xml
new file mode 100644
index 00000000..3da52d57
--- /dev/null
+++ b/app/src/main/res/layout/actionbar_noproject.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
\ 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
index b5b2e215..7d0c8060 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -27,6 +27,7 @@
android:layout_height="wrap_content"
android:visibility="visible" />
+
+
+
diff --git a/app/src/main/res/layout/bottom_sheet_each_item.xml b/app/src/main/res/layout/bottom_sheet_each_item.xml
index 58117440..ff9edb9e 100644
--- a/app/src/main/res/layout/bottom_sheet_each_item.xml
+++ b/app/src/main/res/layout/bottom_sheet_each_item.xml
@@ -5,6 +5,9 @@
android:orientation="vertical"
android:paddingTop="24dp"
android:id="@+id/layout"
+ android:foreground="@drawable/ripplecustom"
+ android:clickable="true"
+ android:focusable="true"
android:background="@color/secondary_bg_black"
android:layout_height="wrap_content">
+
@@ -127,6 +130,9 @@
android:layout_width="match_parent"
android:orientation="vertical"
android:visibility="visible"
+ android:foreground="@drawable/ripplecustom"
+ android:clickable="true"
+ android:focusable="true"
android:layout_height="wrap_content"
android:id="@+id/moderating">
diff --git a/app/src/main/res/layout/more_project_option_bottomsheet.xml b/app/src/main/res/layout/more_project_option_bottomsheet.xml
index 76619a68..bfe86f38 100644
--- a/app/src/main/res/layout/more_project_option_bottomsheet.xml
+++ b/app/src/main/res/layout/more_project_option_bottomsheet.xml
@@ -77,6 +77,9 @@
android:orientation="vertical"
android:visibility="visible"
android:layout_height="wrap_content"
+ android:foreground="@drawable/ripplecustom"
+ android:clickable="true"
+ android:focusable="true"
android:id="@+id/buttons">
diff --git a/app/src/main/res/layout/teams_page_options_bottomsheet.xml b/app/src/main/res/layout/teams_page_options_bottomsheet.xml
index 319c0499..d19545d2 100644
--- a/app/src/main/res/layout/teams_page_options_bottomsheet.xml
+++ b/app/src/main/res/layout/teams_page_options_bottomsheet.xml
@@ -76,6 +76,9 @@
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingTop="24dp"
+ android:foreground="@drawable/ripplecustom"
+ android:clickable="true"
+ android:focusable="true"
android:id="@+id/share_button"
android:background="@color/secondary_bg_black"
android:layout_height="wrap_content">