Skip to content
Snippets Groups Projects
Commit 501aaad6 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Improve 'About' view loading

parent 9e93b1d7
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@
package org.videolan.vlc.gui;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
......@@ -50,31 +51,45 @@ public class AboutFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.about, container, false);
}
@Override
public void onViewCreated(final View v, @Nullable Bundle savedInstanceState) {
super.onViewCreated(v, savedInstanceState);
if (getActivity() instanceof AppCompatActivity)
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("VLC " + BuildConfig.VERSION_NAME);
View v = inflater.inflate(R.layout.about, container, false);
//Fix android 7 Locale problem with webView
//https://stackoverflow.com/questions/40398528/android-webview-locale-changes-abruptly-on-android-n
if (AndroidUtil.isNougatOrLater)
VLCApplication.setLocale();
View aboutMain = v.findViewById(R.id.about_main);
WebView webView = (WebView)v.findViewById(R.id.webview);
String revision = getString(R.string.build_revision);
webView.loadData(Util.readAsset("licence.htm", "").replace("!COMMITID!",revision), "text/html", "UTF8");
final View aboutMain = v.findViewById(R.id.about_main);
final WebView webView = v.findViewById(R.id.webview);
final String revision = getString(R.string.build_revision);
UiTools.fillAboutView(v);
View[] lists = new View[]{aboutMain, webView};
String[] titles = new String[] {getString(R.string.about), getString(R.string.licence)};
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mViewPager = v.findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(MODE_TOTAL-1);
mViewPager.setAdapter(new AudioPagerAdapter(lists, titles));
mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
mTabLayout = v.findViewById(R.id.sliding_tabs);
mTabLayout.setupWithViewPager(mViewPager);
return v;
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
final String asset = Util.readAsset("licence.htm", "").replace("!COMMITID!",revision);
VLCApplication.runOnMainThread(new Runnable() {
@Override
public void run() {
UiTools.fillAboutView(v);
webView.loadData(asset, "text/html", "UTF8");
}
});
}
});
}
}
......@@ -219,19 +219,19 @@ public class UiTools {
}
public static void fillAboutView(View v) {
TextView link = (TextView) v.findViewById(R.id.main_link);
final TextView link = v.findViewById(R.id.main_link);
link.setText(Html.fromHtml(VLCApplication.getAppResources().getString(R.string.about_link)));
String revision = VLCApplication.getAppResources().getString(R.string.build_revision)+" VLC: "+VLCApplication.getAppResources().getString(R.string.build_vlc_revision);
String builddate = VLCApplication.getAppResources().getString(R.string.build_time);
String builder = VLCApplication.getAppResources().getString(R.string.build_host);
final String revision = VLCApplication.getAppResources().getString(R.string.build_revision)+" VLC: "+VLCApplication.getAppResources().getString(R.string.build_vlc_revision);
final String builddate = VLCApplication.getAppResources().getString(R.string.build_time);
final String builder = VLCApplication.getAppResources().getString(R.string.build_host);
TextView compiled = (TextView) v.findViewById(R.id.main_compiled);
final TextView compiled = v.findViewById(R.id.main_compiled);
compiled.setText(builder + " (" + builddate + ")");
TextView textview_rev = (TextView) v.findViewById(R.id.main_revision);
final TextView textview_rev = v.findViewById(R.id.main_revision);
textview_rev.setText(VLCApplication.getAppResources().getString(R.string.revision) + " " + revision + " (" + builddate + ") " + BuildConfig.FLAVOR_abi);
final ImageView logo = (ImageView) v.findViewById(R.id.logo);
final ImageView logo = v.findViewById(R.id.logo);
logo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment