-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DROID-2797 Date as an object | Support relative dates setting as defa…
…ult in object lists (#1908)
- Loading branch information
1 parent
7acda60
commit da83051
Showing
18 changed files
with
171 additions
and
80 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
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
9 changes: 9 additions & 0 deletions
9
domain/src/main/java/com/anytypeio/anytype/domain/resources/StringResourceProvider.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,9 @@ | ||
package com.anytypeio.anytype.domain.resources | ||
|
||
import com.anytypeio.anytype.core_models.RelativeDate | ||
|
||
interface StringResourceProvider { | ||
fun getRelativeDateName(relativeDate: RelativeDate): String | ||
fun getDeletedObjectTitle(): String | ||
fun getUntitledObjectTitle(): String | ||
} |
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
30 changes: 30 additions & 0 deletions
30
...ation/src/main/java/com/anytypeio/anytype/presentation/util/StringResourceProviderImpl.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,30 @@ | ||
package com.anytypeio.anytype.presentation.util | ||
|
||
import android.content.Context | ||
import com.anytypeio.anytype.core_models.RelativeDate | ||
import com.anytypeio.anytype.domain.resources.StringResourceProvider | ||
import com.anytypeio.anytype.presentation.R | ||
import javax.inject.Inject | ||
|
||
class StringResourceProviderImpl @Inject constructor(private val context: Context) : | ||
StringResourceProvider { | ||
|
||
override fun getRelativeDateName(relativeDate: RelativeDate): String { | ||
return when (relativeDate) { | ||
RelativeDate.Empty -> "" | ||
is RelativeDate.Other -> relativeDate.formattedDate | ||
is RelativeDate.Today -> context.getString(R.string.today) | ||
is RelativeDate.Tomorrow -> context.getString(R.string.tomorrow) | ||
is RelativeDate.Yesterday -> context.getString(R.string.yesterday) | ||
else -> "" | ||
} | ||
} | ||
|
||
override fun getDeletedObjectTitle(): String { | ||
return context.getString(R.string.non_existent_object) | ||
} | ||
|
||
override fun getUntitledObjectTitle(): String { | ||
return context.getString(R.string.untitled) | ||
} | ||
} |
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.