-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]: ability to select custom datetime format
- Loading branch information
Showing
41 changed files
with
269 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
app/src/main/java/com/f0x1d/logfox/extensions/TimeExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
package com.f0x1d.logfox.extensions | ||
|
||
import java.text.SimpleDateFormat | ||
import java.util.Date | ||
import java.util.Locale | ||
|
||
private val logDateFormat = SimpleDateFormat("dd.MM", Locale.US) | ||
private val logTimeFormat = SimpleDateFormat("HH:mm:ss.SSS", Locale.US) | ||
private val exportDateFormat = SimpleDateFormat("dd-MM_HH-mm-ss", Locale.US) | ||
private val defaultDateFormat = SimpleDateFormat("dd.MM HH:mm:ss", Locale.US) | ||
|
||
val Long.logsDateFormatted get() = logDateFormat.format(this) | ||
val Long.logsTimeFormatted get() = logTimeFormat.format(this) | ||
val Long.exportFormatted get() = exportDateFormat.format(this) | ||
val Long.defaultFormatted get() = defaultDateFormat.format(this) | ||
fun Long.toLocaleString() = Date(this).toLocaleString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/f0x1d/logfox/extensions/context/ContextDIExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.f0x1d.logfox.extensions.context | ||
|
||
import android.content.Context | ||
import com.f0x1d.logfox.utils.DateTimeFormatter | ||
import com.f0x1d.logfox.utils.preferences.AppPreferences | ||
import dagger.hilt.EntryPoint | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.EntryPointAccessors | ||
import dagger.hilt.components.SingletonComponent | ||
import io.github.inflationx.viewpump.ViewPump | ||
|
||
val Context.appPreferences get() = extensionsEntryPoint.appPreferences() | ||
val Context.dateTimeFormatter get() = extensionsEntryPoint.dateTimeFormatter() | ||
val Context.viewPump get() = extensionsEntryPoint.viewPump() | ||
|
||
private val Context.extensionsEntryPoint get() = EntryPointAccessors.fromApplication( | ||
this, | ||
ContextExtensionsEntryPoint::class.java | ||
) | ||
|
||
@EntryPoint | ||
@InstallIn(SingletonComponent::class) | ||
private interface ContextExtensionsEntryPoint { | ||
fun appPreferences(): AppPreferences | ||
fun dateTimeFormatter(): DateTimeFormatter | ||
fun viewPump(): ViewPump | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.