Completed implementing AboutActivity.kt
Completed integrating faqs api and FaqActivity.kt
This commit is contained in:
@@ -16,9 +16,12 @@
|
||||
android:theme="@style/Theme.Woka"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".home.sidebar.AboutActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:name=".home.sidebar.FaqActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".home.sidebar.AboutActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".home.MoreHomeActivity"
|
||||
android:exported="false"
|
||||
|
||||
@@ -9,7 +9,7 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.bumptech.glide.Glide
|
||||
import com.woka.R
|
||||
import com.woka.databinding.BlogViewHolderBinding
|
||||
import com.woka.modules.blogs.Blog
|
||||
import com.woka.modules.blogs.models.Blog
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class BlogsAdapter(config: AsyncDifferConfig<Blog>) :
|
||||
|
||||
@@ -149,7 +149,9 @@ class HomeActivity : WokaBaseActivity(),
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (binding.bottomNav.getSelectedTab() != HOME){
|
||||
if (binding.homeDrawer.isDrawerOpen(GravityCompat.END)){
|
||||
binding.homeDrawer.closeDrawer(GravityCompat.END)
|
||||
}else if (binding.bottomNav.getSelectedTab() != HOME){
|
||||
binding.bottomNav.selectTab(HOME)
|
||||
}else {
|
||||
super.onBackPressed()
|
||||
|
||||
@@ -9,7 +9,7 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.woka.R
|
||||
import com.woka.databinding.ActivityMoreHomeBinding
|
||||
import com.woka.modules.BlogsRepository
|
||||
import com.woka.modules.blogs.BlogsRepository
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.hide
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.woka.home.sidebar
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.transition.Fade
|
||||
import android.transition.Slide
|
||||
import android.view.Gravity.END
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.woka.R
|
||||
|
||||
21
app/src/main/java/com/woka/home/sidebar/FaqActivity.kt
Normal file
21
app/src/main/java/com/woka/home/sidebar/FaqActivity.kt
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.woka.home.sidebar
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.woka.R
|
||||
|
||||
class FaqActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_faq)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.woka.modules
|
||||
|
||||
import com.woka.modules.blogs.BlogsResponse
|
||||
import com.woka.modules.blogs.models.BlogsResponse
|
||||
import com.woka.modules.faqs.models.FaqResponse
|
||||
import com.woka.networking.ApiResponse
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface ModuleApiService {
|
||||
|
||||
@GET("blogs")
|
||||
suspend fun getBlogs(): Response<ApiResponse<BlogsResponse>>
|
||||
|
||||
@POST("faq_listing")
|
||||
suspend fun getFaqs(): Response<ApiResponse<FaqResponse>>
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.woka.modules
|
||||
package com.woka.modules.blogs
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.woka.modules.blogs.BlogsResponse
|
||||
import com.woka.modules.ModuleApiService
|
||||
import com.woka.modules.blogs.models.BlogsResponse
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.networking.RetrofitHelper
|
||||
import com.woka.networking.RetrofitHelper.handleApiCall
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.woka.modules.blogs
|
||||
package com.woka.modules.blogs.models
|
||||
|
||||
data class Blog(
|
||||
val article_url: Any?,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.woka.modules.blogs
|
||||
package com.woka.modules.blogs.models
|
||||
|
||||
data class BlogsResponse(
|
||||
val blogs: List<Blog?>?,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.woka.modules.blogs
|
||||
package com.woka.modules.blogs.models
|
||||
|
||||
data class ContentMoreDetail(
|
||||
val article: String?,
|
||||
37
app/src/main/java/com/woka/modules/faqs/FAQsRepository.kt
Normal file
37
app/src/main/java/com/woka/modules/faqs/FAQsRepository.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.woka.modules.faqs
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.woka.modules.ModuleApiService
|
||||
import com.woka.modules.faqs.models.FaqResponse
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.networking.RetrofitHelper
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
object FAQsRepository {
|
||||
|
||||
private val apiService = RetrofitHelper.getRetrofit().create(ModuleApiService::class.java)
|
||||
|
||||
private val _faqLiveData = MutableLiveData<ApiResult<FaqResponse>>()
|
||||
val faqLiveData: LiveData<ApiResult<FaqResponse>?>
|
||||
get() = _faqLiveData
|
||||
|
||||
init {
|
||||
loadFaqs()
|
||||
}
|
||||
|
||||
private suspend fun getBlogs(): ApiResult<FaqResponse> {
|
||||
return RetrofitHelper.handleApiCall {
|
||||
apiService.getFaqs()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadFaqs(){
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
_faqLiveData.postValue(ApiResult.Loading())
|
||||
_faqLiveData.postValue(getBlogs())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.woka.modules.faqs.models
|
||||
|
||||
data class FaqResponse(
|
||||
val result: List<Result?>?,
|
||||
val total_records: Int?
|
||||
)
|
||||
10
app/src/main/java/com/woka/modules/faqs/models/Result.kt
Normal file
10
app/src/main/java/com/woka/modules/faqs/models/Result.kt
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.woka.modules.faqs.models
|
||||
|
||||
data class Result(
|
||||
val category_master_id: Int?,
|
||||
val english_answer: String?,
|
||||
val english_question: String?,
|
||||
val hindi_answer: String?,
|
||||
val hindi_question: String?,
|
||||
val id: Int?
|
||||
)
|
||||
10
app/src/main/res/drawable/faq_bg.xml
Normal file
10
app/src/main/res/drawable/faq_bg.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<gradient android:startColor="#09005D"
|
||||
android:centerColor="#4B3DD0"
|
||||
android:endColor="#09005D"
|
||||
android:angle="270"
|
||||
/>
|
||||
|
||||
</shape>
|
||||
@@ -70,16 +70,16 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum"
|
||||
android:text="@string/about_woka_description"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
android:textAlignment="center"
|
||||
|
||||
app:layout_constraintTop_toBottomOf="@id/g1"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="25dp"
|
||||
|
||||
/>
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginVertical="25dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
11
app/src/main/res/layout/activity_faq.xml
Normal file
11
app/src/main/res/layout/activity_faq.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/faq_bg"
|
||||
tools:context=".home.sidebar.FaqActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -138,4 +138,5 @@
|
||||
<string name="blogs">Blogs</string>
|
||||
<string name="masila">MASILA</string>
|
||||
<string name="play_trailer">PLAY TRAILER</string>
|
||||
<string name="about_woka_description">WOKA endeavours to make this world a happier and a safe place for Children. A world where families and communities unite joyfully in celebration of their unity and learn from each other\'s diversity.</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user