Skip to content

Commit af166c7

Browse files
committed
语言切换
1 parent 4d2877b commit af166c7

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

app/src/main/java/com/tokenbank/fragment/MainUserFragment.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,36 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
4444
initView(view);
4545
}
4646

47+
@Override
48+
public void onResume() {
49+
super.onResume();
50+
mLayoutManageWallet.setClickable(true);
51+
mLayoutRecordTransaction.setClickable(true);
52+
mLayoutNotification.setClickable(true);
53+
mLayoutHelp.setClickable(true);
54+
mLayoutAbout.setClickable(true);
55+
mLayoutLanguage.setClickable(true);
56+
}
4757

4858
@Override
4959
public void onClick(View view) {
5060
if (view == mLayoutManageWallet) {
61+
mLayoutManageWallet.setClickable(false);
5162
ManageWalletActivity.startModifyWalletActivity(getActivity());
5263
} else if (view == mLayoutRecordTransaction) {
64+
mLayoutRecordTransaction.setClickable(false);
5365
TransactionRecordActivity.startTransactionRecordActivity(getActivity(), 2);
5466
} else if (view == mLayoutNotification) {
67+
mLayoutNotification.setClickable(false);
5568
TransactionRecordActivity.startTransactionRecordActivity(getActivity(), 1);
5669
} else if (view == mLayoutHelp) {
70+
mLayoutHelp.setClickable(false);
5771
WebBrowserActivity.startWebBrowserActivity(getActivity(), getString(R.string.titleBar_help_center), Constant.help_url);
5872
} else if (view == mLayoutAbout) {
73+
mLayoutAbout.setClickable(false);
5974
AboutActivity.startAboutActivity(getActivity());
6075
} else if (view == mLayoutLanguage) {
76+
mLayoutLanguage.setClickable(false);
6177
LanguageActivity.startLanguageActivity(getActivity());
6278
}
6379
}

app/src/main/java/com/tokenbank/utils/LanguageUtil.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -131,41 +131,4 @@ public static Context updateLocale(Context pContext, Locale pNewUserLocale) {
131131
public static boolean needUpdateLocale(Context pContext, Locale pNewUserLocale) {
132132
return pNewUserLocale != null && !getCurrentLocale(pContext).equals(pNewUserLocale);
133133
}
134-
135-
136-
// public static Context selectLanguage(Context context, String language) {
137-
// Context updateContext;
138-
// //设置语言类型
139-
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
140-
// updateContext = createConfigurationResources(context, language);
141-
// } else {
142-
// applyLanguage(context, language);
143-
// updateContext = context;
144-
// }
145-
// //保存设置语言的类型
146-
// return updateContext;
147-
// }
148-
149-
// @TargetApi(Build.VERSION_CODES.N)
150-
// private static Context createConfigurationResources(Context context, String language) {
151-
// //设置语言类型
152-
// Resources resources = context.getResources();
153-
// Configuration configuration = resources.getConfiguration();
154-
// Locale locale = new Locale(language);
155-
// configuration.setLocale(locale);
156-
// return context.createConfigurationContext(configuration);
157-
// }
158-
//
159-
// private static void applyLanguage(Context context, String language) {
160-
// Resources resources = context.getResources();
161-
// Configuration configuration = resources.getConfiguration();
162-
// DisplayMetrics dm = resources.getDisplayMetrics();
163-
// Locale locale = new Locale(language);
164-
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
165-
// configuration.setLocale(locale);
166-
// } else {
167-
// configuration.locale = locale;
168-
// }
169-
// resources.updateConfiguration(configuration, dm);
170-
// }
171134
}

0 commit comments

Comments
 (0)