Exemplo n.º 1
0
 /** Initialize the DownCenter class */
 private void init() throws LibVlcException {
   Log.i(TAG, "Initializing DownCenter");
   if (!mIsInitialized) {
     mlibvlc = Util.getLibVlcInstance();
     mIsInitialized = true;
   }
 }
Exemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    if (!LibVlcUtil.hasCompatibleCPU(this)) {
      Log.e(TAG, LibVlcUtil.getErrorMsg());
      Intent i = new Intent(this, CompatErrorActivity.class);
      startActivity(i);
      finish();
      super.onCreate(savedInstanceState);
      return;
    }
    setTitleColor(Color.WHITE);
    /* Get the current version from package */
    PackageInfo pinfo = null;
    try {
      pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
      Log.e(TAG, "package info not found.");
    }
    if (pinfo != null) mVersionNumber = pinfo.versionCode;

    /* Get settings */
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);

    /* Check if it's the first run */
    mFirstRun = mSettings.getInt(PREF_FIRST_RUN, -1) != mVersionNumber;
    if (mFirstRun) {
      Editor editor = mSettings.edit();
      editor.putInt(PREF_FIRST_RUN, mVersionNumber);
      editor.commit();
    }

    try {
      // Start LibVLC
      Util.getLibVlcInstance();
    } catch (LibVlcException e) {
      e.printStackTrace();
      Intent i = new Intent(this, CompatErrorActivity.class);
      i.putExtra("runtimeError", true);
      i.putExtra("message", "LibVLC failed to initialize (LibVlcException)");
      startActivity(i);
      finish();
      super.onCreate(savedInstanceState);
      return;
    }

    super.onCreate(savedInstanceState);

    /** * Start initializing the UI ** */

    /* Enable the indeterminate progress feature */
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set up the sliding menu
    setContentView(R.layout.local_movie_main);
    prepareActionBar();
    VideoGridFragment fragment = new VideoGridFragment();
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.fragment_placeholder, fragment)
        .commit();
  }