ClassZeroActivity.java revision 8eed706474910ccb978acda03e85d3261037da6e
1/*
2 * Copyright (C) 2007-2008 Esmertec AG.
3 * Copyright (C) 2007-2008 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package com.android.mms.ui;
19
20import android.app.Activity;
21import android.app.AlertDialog;
22import android.content.DialogInterface;
23import android.content.DialogInterface.OnClickListener;
24import android.os.Bundle;
25import android.view.Window;
26
27import com.android.mms.R;
28import com.android.mms.transaction.SmsReceiverService;
29
30/**
31 * Display a class-zero SMS message to the user.  Wait for the user to
32 * dismiss it.
33 */
34public class ClassZeroActivity extends Activity {
35    @Override
36    protected void onCreate(Bundle icicle) {
37        super.onCreate(icicle);
38        requestWindowFeature(Window.FEATURE_NO_TITLE);
39        getWindow().setBackgroundDrawableResource(
40                R.drawable.class_zero_background);
41
42        CharSequence messageChars =  getIntent().getCharSequenceExtra(
43                SmsReceiverService.CLASS_ZERO_BODY_KEY);
44
45        new AlertDialog.Builder(this)
46                .setMessage(messageChars)
47                .setPositiveButton(android.R.string.ok, mOkListener)
48                .setCancelable(false)
49                .show();
50    }
51
52    private final OnClickListener mOkListener = new OnClickListener() {
53        public void onClick(DialogInterface dialog, int whichButton) {
54            ClassZeroActivity.this.finish();
55        }
56    };
57}
58