Skip to content

Commit

Permalink
pre 4.1.1 Patch 10 done (#62)
Browse files Browse the repository at this point in the history
pre 4.1.1 Patch 10 done
  • Loading branch information
logicalNil authored Nov 26, 2022
2 parents b1cf55d + a649a1f commit 7133215
Show file tree
Hide file tree
Showing 16 changed files with 144 additions and 24 deletions.
6 changes: 3 additions & 3 deletions bitapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId "com.atech.bit"
minSdk 24
targetSdk 33
versionCode 35
versionName "4.1.1 Patch 9"
versionCode 36
versionName "4.1.1 Patch 10"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -102,7 +102,7 @@ dependencies {
implementation "com.google.android.gms:play-services-ads:$playServicesAds"

// crashlytics
// implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class MainActivity : AppCompatActivity(), DrawerLocker, MenuClick {
R.id.nav_share -> shareApp()
R.id.nav_mail -> this@MainActivity.openBugLink()
R.id.nav_erp -> this@MainActivity.openCustomChromeTab(resources.getString(R.string.erp_link))
R.id.nav_issue_app_data -> this@MainActivity.openCustomChromeTab(resources.getString(R.string.issue_link_app_data))
R.id.nav_rate -> startReviewFlow()
R.id.nav_issue -> this@MainActivity.openCustomChromeTab(resources.getString(R.string.issue_link))
R.id.nav_github -> this@MainActivity.openCustomChromeTab(resources.getString(R.string.github_link))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.atech.bit.databinding.FragmentCourseBinding
import com.atech.bit.utils.addViews
import com.atech.bit.utils.setExitShareAxisTransition
import com.atech.core.api.ApiRepository
import com.atech.core.api.syllabus.CourseDetail
import com.atech.core.utils.DataState
import com.google.android.material.transition.MaterialSharedAxis
import com.google.firebase.firestore.FirebaseFirestore
Expand Down Expand Up @@ -77,30 +78,32 @@ class CourseFragment : Fragment(R.layout.fragment_course) {
}
}

private fun bindUi(course: List<String>) = binding.llCourse.run {
private fun bindUi(course: List<CourseDetail>) = binding.llCourse.run {

course.forEach { s ->
addViews(requireActivity(), R.layout.row_course, s) { course, view ->
view.findViewById<TextView>(R.id.tv_course_name).text = course
view.findViewById<TextView>(R.id.tv_course_name).text = course.courseName
view.rootView.apply {
setOnClickListener {
navigateToSemChoose(course)
navigateToSemChoose(course.courseName, course.totalSemester)
}
}
}
}
}



override fun onPause() {
super.onPause()
myScrollViewerInstanceState = binding.nestedViewSyllabus.onSaveInstanceState()
}

private fun navigateToSemChoose(request: String) {
private fun navigateToSemChoose(request: String,sem :Int) {
setExitShareAxisTransition()
try {
val action =
CourseFragmentDirections.actionCourseFragmentToSemChooseFragment(request)
CourseFragmentDirections.actionCourseFragmentToSemChooseFragment(request,sem)
findNavController().navigate(action)
} catch (e: Exception) {
Toast.makeText(requireContext(), "Press one item at a time !!", Toast.LENGTH_SHORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class ChooseSemViewModel @Inject constructor(

}.asLiveData()

val totalSem = state.get<Int>("sem") ?: 6

var chooseSemNestedViewPosition: Int? = state["chooseSemNestedViewPosition"]
set(value) {
field = value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Bundle
import android.util.Log
import android.view.View
import android.viewbinding.library.fragment.viewBinding
import android.widget.Button
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.core.view.doOnPreDraw
Expand Down Expand Up @@ -38,6 +39,7 @@ import com.atech.core.utils.KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY
import com.atech.core.utils.RemoteConfigUtil
import com.atech.core.utils.openCustomChromeTab
import com.atech.core.utils.showSnackBar
import com.google.android.material.chip.Chip
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.transition.MaterialElevationScale
import com.google.android.material.transition.MaterialSharedAxis
Expand Down Expand Up @@ -115,7 +117,7 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
getOnlineSyllabus()
setAds()
setSyllabusEnableModel()

setSemButtons()
}

private fun navigateToViewOnlineSyllabus(model: SubjectModel) {
Expand Down Expand Up @@ -194,6 +196,9 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
}
}
viewModel.theory.observe(viewLifecycleOwner) {
binding.semChoseExt.showTheory.isVisible = it.isNotEmpty()
binding.semChoseExt.textView6.isVisible = it.isNotEmpty()
setOfflineNoData(binding.semChoseExt.showTheory.isVisible, binding.semChoseExt.showLab.isVisible, binding.semChoseExt.showPe.isVisible)
courseTheoryAdapter.submitList(it)
}
viewModel.lab.observe(viewLifecycleOwner) {
Expand All @@ -214,6 +219,11 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
}
}

private fun setOfflineNoData(theory: Boolean, lab: Boolean, pe: Boolean) {
binding.semChoseExt.lvNoData.isVisible = !(theory && lab && pe)
binding.semChoseExt.lvContent.isVisible = theory && lab && pe
}

private fun setSyllabusEnableModel() {
val source = pref.getString(
KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY,
Expand Down Expand Up @@ -246,6 +256,8 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
dataState.exception.message
)
}
}else{
Log.d("AAA", "getOnlineSyllabus: ${dataState.exception.message}")
}

}
Expand All @@ -257,7 +269,9 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
}

is DataState.Success -> {
Log.d("AAA", "getOnlineSyllabus: ${dataState.data}")
dataState.data.semester?.let { syllabus ->

setOnLineData(syllabus)
}
setViewOfOnlineSyllabusExt(dataState.data.semester != null)
Expand Down Expand Up @@ -316,6 +330,13 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
}
}

private fun setSemButtons() = binding.apply{
for(i in 1..viewModel.totalSem){
val button = binding.javaClass.getField("bt$i").get(binding) as Chip
button.isVisible = true
}
}


private fun buttonClick() {
binding.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ class HomeFragment : Fragment(R.layout.fragment_home) {
Log.e(TAG, "setDefaultValueForSwitch: $it")
}) {
val switchState = remoteConfigUtil.getString(KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY)
Log.d(TAG, "setDefaultValueForSwitch: $switchState")
pref.edit()
.putString(KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY, switchState)
.apply()
Expand Down
19 changes: 17 additions & 2 deletions bitapp/src/main/java/com/atech/bit/utils/SyllabusEnableModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ data class SyllabusEnableModel(
val bba4: Boolean = false,
val bba5: Boolean = false,
val bba6: Boolean = false,
val mca1: Boolean = false,
val mca2: Boolean = false,
val mca3: Boolean = false,
val mca4: Boolean = false,
val mba1: Boolean = false,
val mba2: Boolean = false,
val mba3: Boolean = false,
val mba4: Boolean = false
)

fun SyllabusEnableModel.compareToCourseSem(courseSem: String) = this.run {
Expand All @@ -32,8 +40,15 @@ fun SyllabusEnableModel.compareToCourseSem(courseSem: String) = this.run {
"bba4" -> bba4
"bba5" -> bba5
"bba6" -> bba6
else -> {
"mca1" -> mca1
"mca2" -> mca2
"mca3" -> mca3
"mca4" -> mca4
"mba1" -> mba1
"mba2" -> mba2
"mba3" -> mba3
"mba4" -> mba4
else ->
false
}
}
}
2 changes: 1 addition & 1 deletion bitapp/src/main/res/layout/fragment_course.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_width="@dimen/image_view_log_in_size"
android:layout_height="@dimen/image_view_log_in_size"
android:src="@drawable/ic_course"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
14 changes: 13 additions & 1 deletion bitapp/src/main/res/layout/fragment_sem_choose.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
android:id="@+id/sem_chose_ext"
layout="@layout/sem_choose_ext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_below="@id/adView"
android:layout_marginHorizontal="@dimen/grid_1"
android:visibility="visible" />
Expand Down Expand Up @@ -83,6 +83,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sem1"
android:visibility="gone"
tools:visibility="visible"
android:textColor="@color/stroke_tint_text"
android:textSize="15sp"
app:checkedIconTint="@color/stroke_tint_text"
Expand All @@ -94,6 +96,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sem2"
android:visibility="gone"
tools:visibility="visible"
android:textColor="@color/stroke_tint_text"
android:textSize="15sp"
app:checkedIconTint="@color/stroke_tint_text"
Expand All @@ -105,6 +109,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sem3"
android:visibility="gone"
tools:visibility="visible"
android:textColor="@color/stroke_tint_text"
android:textSize="15sp"
app:checkedIconTint="@color/stroke_tint_text"
Expand All @@ -116,6 +122,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sem4"
android:visibility="gone"
tools:visibility="visible"
android:textColor="@color/stroke_tint_text"
android:textSize="15sp"
app:checkedIconTint="@color/stroke_tint_text"
Expand All @@ -127,6 +135,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sem5"
android:visibility="gone"
tools:visibility="visible"
android:textColor="@color/stroke_tint_text"
android:textSize="15sp"
app:checkedIconTint="@color/stroke_tint_text"
Expand All @@ -138,6 +148,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sem6"
android:visibility="gone"
tools:visibility="visible"
android:textColor="@color/stroke_tint_text"
android:textSize="15sp"
app:checkedIconTint="@color/stroke_tint_text"
Expand Down
24 changes: 16 additions & 8 deletions bitapp/src/main/res/layout/row_course.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,33 @@
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/grid_1"
android:layout_marginVertical="@dimen/grid_0_25"
app:cardBackgroundColor="?attr/colorSurface">
android:padding="@dimen/grid_1"
app:cardBackgroundColor="?attr/bottomBar">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:padding="@dimen/grid_1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/blank"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_book"
android:padding="@dimen/grid_2"
app:tint="?attr/colorPrimary" />

<TextView
android:id="@+id/tv_course_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="@dimen/grid_2"
android:textAppearance="?attr/textAppearanceTitleMedium"
android:textAppearance="?attr/textAppearanceTitleLarge"
tools:text="Course Name" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dividerColor="@color/divider_color" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

38 changes: 38 additions & 0 deletions bitapp/src/main/res/layout/sem_choose_ext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,44 @@
android:fillViewport="true"
android:paddingBottom="@dimen/grid_2">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/lv_no_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/min_padding_attendance"
android:orientation="vertical">
<ImageView
android:id="@+id/no_data"
android:layout_width="@dimen/image_view_thumbnail"
android:layout_height="@dimen/image_view_thumbnail"
android:contentDescription="@string/blank"
android:src="@drawable/ic_no_data"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/wrapper_card_view"
app:layout_constraintStart_toStartOf="@+id/wrapper_card_view"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/no_data_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/no_offline_data"
android:textAppearance="?attr/textAppearanceCaption"
app:layout_constraintEnd_toEndOf="@+id/no_data"
app:layout_constraintStart_toStartOf="@+id/no_data"
app:layout_constraintTop_toBottomOf="@+id/no_data" />
</LinearLayout>

<LinearLayout
android:visibility="gone"
android:id="@+id/lvContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
Expand Down Expand Up @@ -122,4 +159,5 @@
</com.google.android.material.card.MaterialCardView>

</LinearLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
4 changes: 4 additions & 0 deletions bitapp/src/main/res/menu/navigation_slider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
android:id="@+id/nav_issue"
android:icon="@drawable/ic_issue"
android:title="@string/report" />
<item
android:id="@+id/nav_issue_app_data"
android:icon="@drawable/ic_issue"
android:title="@string/report_app_data" />
<group
android:id="@+id/group_3"
android:checkableBehavior="single">
Expand Down
4 changes: 4 additions & 0 deletions bitapp/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@
<action
android:id="@+id/action_semChooseFragment_to_viewSyllabusFragment"
app:destination="@id/viewSyllabusFragment" />
<argument
android:name="sem"
app:argType="integer"
android:defaultValue="6" />
</fragment>
<dialog
android:id="@+id/themeChangeDialog"
Expand Down
Loading

0 comments on commit 7133215

Please sign in to comment.