Convert GetText to kotlin
This commit is contained in:
1 parent
64ffe1ee14
commit
0089f232c4
2 files changed
+7
-22
No files matched your search
@@ -89,7 +89,6 @@ class EhApplication : Application(), DefaultLifecycleObserver, ImageLoaderFactor
|
|||||||
}
|
}
|
||||||
super<Application>.onCreate()
|
super<Application>.onCreate()
|
||||||
System.loadLibrary("ehviewer")
|
System.loadLibrary("ehviewer")
|
||||||
GetText.initialize(this)
|
|
||||||
Settings.initialize()
|
Settings.initialize()
|
||||||
ReadableTime.initialize(this)
|
ReadableTime.initialize(this)
|
||||||
AppConfig.initialize(this)
|
AppConfig.initialize(this)
|
||||||
|
|||||||
@@ -13,30 +13,16 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
package com.hippo.ehviewer
|
||||||
|
|
||||||
package com.hippo.ehviewer;
|
import androidx.annotation.StringRes
|
||||||
|
|
||||||
import android.content.Context;
|
object GetText {
|
||||||
import android.content.res.Resources;
|
fun getString(@StringRes id: Int): String {
|
||||||
|
return EhApplication.application.getString(id)
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.StringRes;
|
|
||||||
|
|
||||||
public class GetText {
|
|
||||||
|
|
||||||
private static Resources sResources;
|
|
||||||
|
|
||||||
public static void initialize(Context context) {
|
|
||||||
sResources = context.getApplicationContext().getResources();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
fun getString(@StringRes id: Int, vararg formatArgs: Any?): String {
|
||||||
public static String getString(@StringRes int id) {
|
return EhApplication.application.getString(id, *formatArgs)
|
||||||
return sResources.getString(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public static String getString(@StringRes int id, Object... formatArgs) {
|
|
||||||
return sResources.getString(id, formatArgs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user