2 * Copyright (C) 2012 The CyanogenMod Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.cyanogenmod.filemanager.activities;
19 import android.app.Activity;
20 import android.app.AlertDialog;
21 import android.content.DialogInterface;
22 import android.content.DialogInterface.OnCancelListener;
23 import android.content.DialogInterface.OnDismissListener;
24 import android.os.Bundle;
25 import android.util.Log;
27 import com.cyanogenmod.filemanager.R;
28 import com.cyanogenmod.filemanager.util.DialogHelper;
30 import java.io.InputStream;
33 * The activity for show the changelog of the application
35 public class ChangeLogActivity extends Activity implements OnCancelListener, OnDismissListener {
37 private static final String TAG = "ChangeLogActivity"; //$NON-NLS-1$
39 private static boolean DEBUG = false;
45 protected void onCreate(Bundle state) {
47 Log.d(TAG, "ChangeLogActivity.onCreate"); //$NON-NLS-1$
51 super.onCreate(state);
57 * Initialize the activity. This method handles the passed intent, opens
58 * the appropriate activity and ends.
61 InputStream is = getApplicationContext().getResources().openRawResource(R.raw.changelog);
63 Log.e(TAG, "Changelog file not exists"); //$NON-NLS-1$
70 StringBuilder sb = new StringBuilder();
72 byte[] data = new byte[512];
73 while ((read = is.read(data, 0, 512)) != -1) {
74 sb.append(new String(data, 0, read));
78 AlertDialog dialog = DialogHelper.createAlertDialog(
79 this, R.drawable.ic_launcher,
80 R.string.changelog_title, sb.toString(), false, true);
81 dialog.setOnCancelListener(this);
82 dialog.setOnDismissListener(this);
85 } catch (Exception e) {
86 Log.e(TAG, "Failed to read changelog file", e); //$NON-NLS-1$
92 } catch (Exception e) {/**NON BLOCK**/}
100 public void onDismiss(DialogInterface dialog) {
101 // We have to finish here; this activity is only a wrapper
109 public void onCancel(DialogInterface dialog) {
110 // We have to finish here; this activity is only a wrapper