-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NativeCore, LocaleState, CDSHandler #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I've made an initial pass of the code. I'll try defer manual testing until after MemoryCache
is also implemented.
TransifexNativeSDK/app/src/main/java/com/transifex/myapplication/SimpleIntentService.java
Show resolved
Hide resolved
TransifexNativeSDK/txsdk/src/main/java/com/transifex/txnative/CDSHandler.java
Outdated
Show resolved
Hide resolved
|
||
interface CurrentLocalListener { | ||
|
||
void onLocalChanged(Locale newLocale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onLocalChanged
-> onLocaleChanged
. Also, how about you also pass the previous locale, so that clients can implement more complex business logic depending on the exact change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface is supposed to be used internally. The client is the one that sets the locale in the SDK, if they handle it themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you mean that they know the previous locale and they can use it if they wish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SDK user is the ones who sets the locale and informs the SDK. So, it makes sense that they should keep the previous locale state if needed. Plus, this callback is used internally in the SDK and it's not meant to inform the SDK user of a locale change.
TransifexNativeSDK/txsdk/src/main/java/com/transifex/txnative/LocaleState.java
Outdated
Show resolved
Hide resolved
TransifexNativeSDK/txsdk/src/main/java/com/transifex/txnative/LocaleState.java
Outdated
Show resolved
Hide resolved
TransifexNativeSDK/txsdk/src/main/java/com/transifex/txnative/NativeCore.java
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
private LocaleState.CurrentLocalListener mCurrentLocalListener = new LocaleState.CurrentLocalListener() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CurrentLocalListener
-> CurrentLocaleListener
, mCurrentLocalListener
-> mCurrentLocaleListener
TransifexNativeSDK/txsdk/src/main/java/com/transifex/txnative/TxNative.java
Outdated
Show resolved
Hide resolved
TransifexNativeSDK/app/src/main/java/com/transifex/myapplication/SimpleIntentService.java
Show resolved
Hide resolved
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">Transifex Application ελ</string> | ||
|
||
<string name="demo_activity_name">Transifex demo activity ελ</string> | ||
|
||
<string name="title">Transifex SDK ελ</string> | ||
<string name="subtitle">String demo ελ</string> | ||
|
||
<string name="hello_world">Hello World! ελ</string> | ||
|
||
<string name="welcome_text">Welcome to our demo ελ</string> | ||
</resources> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file partially filled on purpose or is it WIP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's WIP.
Implemented NativeCore, LocaleState, CDSHandler. Added an example where the SDK is used to wrap the context of a service, "SimpleIntentService".
6f9a414
to
e3da20d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Implemented NativeCore, LocaleState, CDSHandler.
Added an example where the SDK is used to wrap
the context of a service, "SimpleIntentService".