Skip to content
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

Use user specified Locale in BaseStatePageAdapter::setPagerTitles() #485

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.mxt.anitrend.base.custom.pager;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;

import androidx.annotation.ArrayRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import com.mxt.anitrend.extension.KoinExt;
import com.mxt.anitrend.util.Settings;

import java.util.Locale;

/**
Expand All @@ -27,7 +31,9 @@ public BaseStatePageAdapter(FragmentManager fragmentManager, Context context) {
}

public void setPagerTitles(@ArrayRes int mTitleRes) {
mTitles = context.getResources().getStringArray(mTitleRes);
Configuration configuration = new Configuration(context.getResources().getConfiguration());
configuration.setLocale(new Locale(KoinExt.get(Settings.class).getUserLanguage()));
mTitles = context.createConfigurationContext(configuration).getResources().getStringArray(mTitleRes);
}

public String[] getPagerTitles() {
Expand Down