Sha256: 9a3ce4cc5dff191c8ba71e53e995f0d3e73371d67d6cfcdc43bf150947fef7a5
Contents?: true
Size: 1.8 KB
Versions: 12
Compression:
Stored size: 1.8 KB
Contents
package com.rhomobile.rhodes; import java.io.IOException; import java.io.InputStream; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import android.widget.ImageView; public class SplashScreen { private static final String LOADING_PNG = "apps/app/loading.png"; private static final String LOADING_PAGE = "apps/app/loading.html"; private View view; private native void nativeStart(); private native void nativeHide(); public SplashScreen(Context ctx) { AssetManager am = ctx.getResources().getAssets(); RhodesService r = RhodesService.getInstance(); //boolean bc = r.isBundleChanged(); String file = LOADING_PNG; Bitmap bitmap = null; try { InputStream is = am.open(file); bitmap = BitmapFactory.decodeStream(is); is.close(); ImageView v = new ImageView(ctx); v.setImageBitmap(bitmap); v.setId(RhodesService.RHO_SPLASH_VIEW); view = v; } catch (IOException e) { WebView v = r.createWebView(); String page = LOADING_PAGE; boolean hasNeededPage; try { InputStream is1 = am.open(page); if (is1 != null) is1.close(); hasNeededPage = true; } catch (IOException e1) { hasNeededPage = false; } if (hasNeededPage) { v.loadUrl("file:///android_asset/" + page); } else { v.loadData("<html><title>Loading</title><body>Loading...</body></html>", "text/html", "utf-8"); } v.setId(RhodesService.RHO_SPLASH_VIEW); view = v; } } public void start(ViewGroup outer) { outer.removeAllViews(); outer.addView(view); nativeStart(); } public void hide(ViewGroup outer) { nativeHide(); outer.removeView(view); } }
Version data entries
12 entries across 12 versions & 1 rubygems