Refactoring

This commit is contained in:
M66B 2021-04-04 10:05:10 +02:00
parent d02a4fe819
commit a98b0013fe
1 changed files with 5 additions and 5 deletions

View File

@ -51,6 +51,8 @@ public class FragmentAbout extends FragmentBase {
setSubtitle(R.string.menu_about); setSubtitle(R.string.menu_about);
setHasOptionsMenu(true); setHasOptionsMenu(true);
final Context context = getContext();
View view = inflater.inflate(R.layout.fragment_about, container, false); View view = inflater.inflate(R.layout.fragment_about, container, false);
TextView tvVersion = view.findViewById(R.id.tvVersion); TextView tvVersion = view.findViewById(R.id.tvVersion);
@ -65,18 +67,18 @@ public class FragmentAbout extends FragmentBase {
long last = 0; long last = 0;
try { try {
PackageManager pm = getContext().getPackageManager(); PackageManager pm = context.getPackageManager();
PackageInfo pi = pm.getPackageInfo(BuildConfig.APPLICATION_ID, 0); PackageInfo pi = pm.getPackageInfo(BuildConfig.APPLICATION_ID, 0);
last = pi.lastUpdateTime; last = pi.lastUpdateTime;
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }
DateFormat DF = Helper.getDateTimeInstance(getContext(), DateFormat.SHORT, DateFormat.SHORT); DateFormat DF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);
tvUpdated.setText(getString(R.string.app_updated, last == 0 ? "-" : DF.format(last))); tvUpdated.setText(getString(R.string.app_updated, last == 0 ? "-" : DF.format(last)));
ibUpdate.setVisibility( ibUpdate.setVisibility(
Helper.hasValidFingerprint(getContext()) || BuildConfig.DEBUG Helper.hasValidFingerprint(context) || BuildConfig.DEBUG
? View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE);
ibUpdate.setOnClickListener(new View.OnClickListener() { ibUpdate.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -96,8 +98,6 @@ public class FragmentAbout extends FragmentBase {
} }
}); });
final Context context = getContext();
TypedValue style = new TypedValue(); TypedValue style = new TypedValue();
context.getTheme().resolveAttribute(R.style.TextAppearance_AppCompat_Small, style, true); context.getTheme().resolveAttribute(R.style.TextAppearance_AppCompat_Small, style, true);