• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 package com.android.quake;
18 
19 import android.view.View;
20 import android.content.Context;
21 import android.graphics.Paint;
22 import android.graphics.Canvas;
23 
24 public class QuakeViewNoData extends View {
QuakeViewNoData(Context context, int reason)25     public QuakeViewNoData(Context context, int reason)
26     {
27         super(context);
28         mReason = reason;
29     }
30 
31     public static final int E_NODATA = 1;
32     public static final int E_INITFAILED = 2;
33 
34     @Override
onDraw(Canvas canvas)35     protected void onDraw(Canvas canvas) {
36         Paint paint = new Paint();
37         paint.setColor(0xffffffff);
38         paint.setStyle(Paint.Style.FILL);
39         canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
40         paint.setColor(0xff000000);
41         switch(mReason)
42         {
43             case E_NODATA:
44                 canvas.drawText("Missing data files. Looking for one of:",
45                         10.0f, 20.0f, paint);
46                 canvas.drawText("/sdcard/data/quake/id1/pak0.pak",
47                         10.0f, 35.0f, paint);
48                 canvas.drawText("/data/quake/id1/pak0.pak",
49                         10.0f, 50.0f, paint);
50                 canvas.drawText("Please copy a pak file to the device and reboot.",
51                         10.0f, 65.0f, paint);
52                 break;
53             case E_INITFAILED:
54                 canvas.drawText("Quake C library initialization failed.",
55                         10.0f, 20.0f, paint);
56                 canvas.drawText("Try stopping and restarting the simulator.",
57                         10.0f, 35.0f, paint);
58                 break;
59         }
60     }
61 
62     private int mReason;
63 
64 }
65