Skip to content

Commit

Permalink
Merge branch 'master' into sync-investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 committed Nov 1, 2024
2 parents f5e2a88 + 26c327f commit 9584c30
Show file tree
Hide file tree
Showing 25 changed files with 246 additions and 82 deletions.
18 changes: 10 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ apply plugin: 'kotlinx-serialization'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'realm-android'
android {
compileSdk 34
compileSdk 35
defaultConfig {
applicationId "org.ole.planet.myplanet"
minSdkVersion 26
targetSdkVersion 34
versionCode 2061
versionName "0.20.61"
versionCode 2075
versionName "0.20.75"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -155,17 +155,17 @@ repositories {
dependencies {
testImplementation 'junit:junit:4.13.2'
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.annotation:annotation:1.9.0'
implementation 'androidx.annotation:annotation:1.9.1'
implementation 'androidx.exifinterface:exifinterface:1.3.7'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.core:core-ktx:1.13.1"
implementation "androidx.work:work-runtime:2.9.1"
implementation "androidx.core:core-ktx:1.15.0"
implementation "androidx.work:work-runtime:2.10.0"
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
implementation 'androidx.preference:preference-ktx:1.2.1'

Expand Down Expand Up @@ -202,7 +202,7 @@ dependencies {
implementation 'com.mikepenz:crossfadedrawerlayout:1.1.0@aar'
implementation('com.mikepenz:materialdrawer:6.1.1@aar') { transitive = true}

def camera_version = "1.3.4"
def camera_version = "1.4.0"
implementation "androidx.camera:camera-core:$camera_version"
implementation "androidx.camera:camera-camera2:$camera_version"
implementation "androidx.camera:camera-lifecycle:$camera_version"
Expand Down Expand Up @@ -231,6 +231,8 @@ dependencies {
implementation "io.noties.markwon:html:$markwon_version"
implementation "io.noties.markwon:ext-tables:$markwon_version"
implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.0.21"))

implementation 'com.github.chrisbanes:PhotoView:2.3.0'
}
realm {
syncEnabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ class MyDownloadService : Service() {
var timeCount = 1

try {
while (bis.read(data).also { count = it } != -1) {
while (true) {
count = bis.read(data)
if (count == -1) break
total += count
totalFileSize = (fileSize / 1024.0.pow(1.0)).toInt()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class Service(private val context: Context) {
val responses: String?
try {
responses = Gson().fromJson(response.body()?.string(), String::class.java)
if (responses.isEmpty()) {
if (responses == null || responses.isEmpty()) {
callback.onError("Planet up to date", false)
return
}
Expand Down Expand Up @@ -145,10 +145,9 @@ class Service(private val context: Context) {
}
} catch (e: Exception) {
e.printStackTrace()
callback.onError("New apk version required but not found on server - Contact admin", false)
callback.onError("New apk version required but not found on server - Contact admin", false)
}
}

override fun onFailure(call: Call<ResponseBody>, t: Throwable) {}
})
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,26 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N

val paddingVerticalDp = (paddingVerticalPx / density).toInt()
val paddingHorizontalDp = (paddingHorizontalPx / density).toInt()
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
val statusBarHeight = if (resourceId > 0) {
resources.getDimensionPixelSize(resourceId)
} else {
ceil(25 * density).toInt()
}

val header = AccountHeaderBuilder()
.withActivity(this@DashboardActivity)
.withTextColor(ContextCompat.getColor(this, R.color.bg_white))
.withHeaderBackground(R.drawable.ole_logo)
.withDividerBelowHeader(false)
.withTranslucentStatusBar(false)
.withHeightDp(paddingVerticalDp + 20 * 2 + (statusBarHeight / density).toInt())
.build()

val headerBackground = header.headerBackgroundView
headerBackground.setPadding(paddingHorizontalDp, paddingVerticalDp, paddingHorizontalDp, paddingVerticalDp)
headerBackground.setPadding(
paddingHorizontalDp, paddingVerticalDp + statusBarHeight + 25,
paddingHorizontalDp, paddingVerticalDp + 50
)

val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO ||
Expand All @@ -527,10 +537,18 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
}

private fun createDrawer() {
val statusBarHeight = ceil(25 * context.resources.displayMetrics.density).toInt()
val dimenHolder = DimenHolder.fromDp(160 + statusBarHeight)
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
val statusBarHeight = if (resourceId > 0) {
resources.getDimensionPixelSize(resourceId)
} else {
ceil(25 * resources.displayMetrics.density).toInt()
}

val headerHeight = 160 + (statusBarHeight / resources.displayMetrics.density).toInt()
val dimenHolder = DimenHolder.fromDp(headerHeight)

result = headerResult?.let {
DrawerBuilder().withActivity(this).withFullscreen(true)
DrawerBuilder().withActivity(this).withFullscreen(false).withTranslucentStatusBar(false)
.withSliderBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary))
.withToolbar(activityDashboardBinding.myToolbar)
.withAccountHeader(it).withHeaderHeight(dimenHolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,26 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N

val paddingVerticalDp = (paddingVerticalPx / density).toInt()
val paddingHorizontalDp = (paddingHorizontalPx / density).toInt()
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
val statusBarHeight = if (resourceId > 0) {
resources.getDimensionPixelSize(resourceId)
} else {
ceil(25 * density).toInt()
}

val header = AccountHeaderBuilder()
.withActivity(this@DashboardActivity)
.withTextColor(ContextCompat.getColor(this, R.color.bg_white))
.withHeaderBackground(R.drawable.ole_logo)
.withDividerBelowHeader(false)
.withTranslucentStatusBar(false)
.withHeightDp(paddingVerticalDp + 20 * 2 + (statusBarHeight / density).toInt())
.build()

val headerBackground = header.headerBackgroundView
headerBackground.setPadding(paddingHorizontalDp, paddingVerticalDp, paddingHorizontalDp, paddingVerticalDp)
headerBackground.setPadding(
paddingHorizontalDp, paddingVerticalDp + statusBarHeight + 25,
paddingHorizontalDp, paddingVerticalDp + 50
)

val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO ||
Expand All @@ -527,10 +537,18 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
}

private fun createDrawer() {
val statusBarHeight = ceil(25 * context.resources.displayMetrics.density).toInt()
val dimenHolder = DimenHolder.fromDp(160 + statusBarHeight)
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
val statusBarHeight = if (resourceId > 0) {
resources.getDimensionPixelSize(resourceId)
} else {
ceil(25 * resources.displayMetrics.density).toInt()
}

val headerHeight = 160 + (statusBarHeight / resources.displayMetrics.density).toInt()
val dimenHolder = DimenHolder.fromDp(headerHeight)

result = headerResult?.let {
DrawerBuilder().withActivity(this).withFullscreen(true)
DrawerBuilder().withActivity(this).withFullscreen(false).withTranslucentStatusBar(false)
.withSliderBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary))
.withToolbar(activityDashboardBinding.myToolbar)
.withAccountHeader(it).withHeaderHeight(dimenHolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ class UserInformationFragment : BaseDialogFragment(), View.OnClickListener {
}

private fun initViews() {
val adapterLang = ArrayAdapter.createFromResource(
val langArray = resources.getStringArray(R.array.language).toMutableList()
val levelArray = resources.getStringArray(R.array.level).toMutableList()
val adapterLang = ArrayAdapter(
requireContext(),
R.array.language,
R.layout.spinner_item
R.layout.spinner_item_white,
langArray
)
val adapterLevel = ArrayAdapter.createFromResource(
val adapterLevel = ArrayAdapter(
requireContext(),
R.array.level,
R.layout.spinner_item
R.layout.spinner_item_white,
levelArray
)
adapterLang.setDropDownViewResource(R.layout.spinner_item)
adapterLevel.setDropDownViewResource(R.layout.spinner_item)
adapterLang.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
adapterLevel.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
fragmentUserInformationBinding.spnLang.adapter = adapterLang
fragmentUserInformationBinding.spnLevel.adapter = adapterLevel
fragmentUserInformationBinding.spnLang.post {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ole.planet.myplanet.ui.resources

import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.view.MenuItem
Expand All @@ -20,6 +21,7 @@ import org.ole.planet.myplanet.model.RealmRemovedLog.Companion.onAdd
import org.ole.planet.myplanet.model.RealmUserModel
import org.ole.planet.myplanet.service.UserProfileDbHandler
import org.ole.planet.myplanet.utilities.CheckboxListView
import org.ole.planet.myplanet.utilities.LocaleHelper
import org.ole.planet.myplanet.utilities.Utilities.toast
import java.util.Calendar
import java.util.UUID
Expand All @@ -32,6 +34,11 @@ class AddResourceActivity : AppCompatActivity() {
var levels: RealmList<String>? = null
private var resourceFor: RealmList<String>? = null
private var resourceUrl: String? = null

override fun attachBaseContext(base: Context) {
super.attachBaseContext(LocaleHelper.onAttach(base))
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
activityAddResourceBinding = ActivityAddResourceBinding.inflate(layoutInflater)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AdapterTeamList(private val context: Context, private val list: List<Realm
with(holder.binding) {
created.text = TimeUtils.getFormatedDate(team.createdDate)
type.text = team.teamType
type.visibility = if (team.teamType == null) View.VISIBLE else View.GONE
type.visibility = if (team.teamType == null) View.GONE else View.VISIBLE
name.text = team.name
noOfVisits.text = context.getString(R.string.number_placeholder, RealmTeamLog.getVisitByTeam(mRealm, team._id))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ class TeamFragment : Fragment(), AdapterTeamList.OnClickTeamItem {
adapterTeamList.setTeamListener(this@TeamFragment)
requireView().findViewById<View>(R.id.type).visibility =
if (type == null) {
View.VISIBLE
} else {
View.GONE
} else {
View.VISIBLE
}
fragmentTeamBinding.rvTeamList.adapter = adapterTeamList
listContentDescription(conditionApplied)
Expand Down
Loading

0 comments on commit 9584c30

Please sign in to comment.