Skip to content

Commit

Permalink
Merge pull request #20 from kabirnayeem99/feat/home
Browse files Browse the repository at this point in the history
🎨 Theming and styling changes
  • Loading branch information
kabirnayeem99 authored Jun 4, 2022
2 parents 0425786 + c8e5b79 commit c8f5100
Show file tree
Hide file tree
Showing 74 changed files with 7,711 additions and 297 deletions.
12 changes: 8 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ Native Android Application to show the data on https://islamqa.org/.
<img src="https://github.com/kabirnayeem99/islam_qa_org_android/blob/dev/doc/images/demo_home_screen.png" height="500">
<img src="https://github.com/kabirnayeem99/islam_qa_org_android/blob/dev/doc/images/demo_details_page.png" height="500">


<a href="https://www.freepik.com/vectors/islamic-graphic">Islamic graphic vector created by
rawpixel.com - www.freepik.com</a>
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,7 @@ dependencies {
implementation 'androidx.preference:preference:1.2.0'

implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2"

implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
}
14 changes: 13 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:targetApi="31">

<activity
android:name=".ui.start.StartActivity"
android:exported="true">
android:exported="true"
android:theme="@style/StartTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package io.github.kabirnayeem99.islamqaorg.common.utility.ktx

import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.Animation
import android.view.animation.RotateAnimation
import com.google.android.material.snackbar.Snackbar

fun View.showUserMessage(userMessage: String) {
Expand All @@ -16,4 +19,18 @@ fun View.showUserMessage(userMessage: String) {
*/
fun View.viewVisibility(visibility: Int) {
this.visibility = visibility
}

fun View.rotateViewOneEighty(duration: Long = 5000L) {
val rotate = RotateAnimation(
0F,
180F,
Animation.RELATIVE_TO_SELF,
0.5f,
Animation.RELATIVE_TO_SELF,
0.5f
)
rotate.duration = duration
rotate.interpolator = AccelerateDecelerateInterpolator()
startAnimation(rotate)
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,22 @@ class IslamQaLocalDataSource @Inject constructor(
return withContext(Dispatchers.IO) {

try {
val dto = questionDetailDao.getQuestionByLink(url)
var detail: QuestionDetail? = null

val detail = QuestionDetail(
questionTitle = dto.questionTitle,
detailedQuestion = dto.detailedQuestion,
detailedAnswer = dto.detailedAnswer,
fiqh = dto.fiqh,
source = dto.source,
originalLink = dto.originalLink,
nextQuestionLink = dto.nextQuestionLink,
previousQuestionLink = dto.previousQuestionLink,
relevantQuestions = getQuestionList(),
)
questionDetailDao.getQuestionByLink(url)?.let { dto ->

detail = QuestionDetail(
questionTitle = dto.questionTitle,
detailedQuestion = dto.detailedQuestion,
detailedAnswer = dto.detailedAnswer,
fiqh = dto.fiqh,
source = dto.source,
originalLink = dto.originalLink,
nextQuestionLink = dto.nextQuestionLink,
previousQuestionLink = dto.previousQuestionLink,
relevantQuestions = getQuestionList(),
)
}

Timber.d(detail.toString())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class IslamQaRemoteDataSource @Inject constructor(private val scrapingService: S
val questionAnswer = mutableListOf<Question>()
qList.questions.forEachIndexed { index, question ->
val answerLink = qList.questionLinks[index]
questionAnswer.add(Question(index, question, answerLink))
questionAnswer.add(Question(index, question, answerLink, fiqh.displayName))
}
questionAnswer.ifEmpty { throw Exception("Failed to parse links of the questions") }
}
Expand Down Expand Up @@ -96,7 +96,7 @@ class IslamQaRemoteDataSource @Inject constructor(private val scrapingService: S
relevantQuestions = dto.relevantQuestions,
)

Timber.d(detail.toString())
Timber.d("getDetailedQuestionAndAnswer -> $detail")

detail
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ interface QuestionDetailDao {
* @param link String
*/
@Query("SELECT * FROM questiondetailentity WHERE originalLink=:link")
suspend fun getQuestionByLink(link: String): QuestionDetailEntity
suspend fun getQuestionByLink(link: String): QuestionDetailEntity?

}
Loading

0 comments on commit c8f5100

Please sign in to comment.