| Changes to /trunk/DivideAndConquer/src/com/google/android/divideandconquer/GameOverDialog.java |
r0 vs. r40
Edit
|
r40
|
| /trunk/DivideAndConquer/src/com/google/android/divideandconquer/GameOverDialog.java | /trunk/DivideAndConquer/src/com/google/android/divideandconquer/GameOverDialog.java r40 | ||
| 1 | /* | ||
|---|---|---|---|
| 2 | * Copyright (C) 2008 Google Inc. | ||
| 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.google.android.divideandconquer; | ||
| 18 | |||
| 19 | import android.app.Dialog; | ||
| 20 | import android.view.View; | ||
| 21 | import android.content.Context; | ||
| 22 | import android.os.Bundle; | ||
| 23 | |||
| 24 | public class GameOverDialog extends Dialog implements View.OnClickListener { | ||
| 25 | private View mNewGame; | ||
| 26 | |||
| 27 | private final NewGameCallback mCallback; | ||
| 28 | private View mQuit; | ||
| 29 | |||
| 30 | |||
| 31 | public GameOverDialog(Context context, NewGameCallback callback) { | ||
| 32 | super(context); | ||
| 33 | mCallback = callback; | ||
| 34 | } | ||
| 35 | |||
| 36 | @Override | ||
| 37 | protected void onCreate(Bundle savedInstanceState) { | ||
| 38 | super.onCreate(savedInstanceState); | ||
| 39 | |||
| 40 | setTitle(R.string.game_over); | ||
| 41 | |||
| 42 | setContentView(R.layout.game_over_dialog); | ||
| 43 | |||
| 44 | mNewGame = findViewById(R.id.newGame); | ||
| 45 | mNewGame.setOnClickListener(this); | ||
| 46 | |||
| 47 | mQuit = findViewById(R.id.quit); | ||
| 48 | mQuit.setOnClickListener(this); | ||
| 49 | } | ||
| 50 | |||
| 51 | /** {@inheritDoc} */ | ||
| 52 | public void onClick(View v) { | ||
| 53 | if (v == mNewGame) { | ||
| 54 | mCallback.onNewGame(); | ||
| 55 | dismiss(); | ||
| 56 | } else if (v == mQuit) { | ||
| 57 | cancel(); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | } | ||