1 /*
2  * Copyright (C) 2008 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.music;
18 
19 import android.app.Activity;
20 import android.media.AudioManager;
21 import android.os.Bundle;
22 import android.view.View;
23 import android.view.Window;
24 import android.view.WindowManager;
25 import android.widget.Button;
26 import android.widget.TextView;
27 
28 public class DeleteItems extends Activity {
29     private TextView mPrompt;
30     private Button mButton;
31     private long[] mItemList;
32 
33     @Override
onCreate(Bundle icicle)34     public void onCreate(Bundle icicle) {
35         super.onCreate(icicle);
36         setVolumeControlStream(AudioManager.STREAM_MUSIC);
37 
38         requestWindowFeature(Window.FEATURE_NO_TITLE);
39         setContentView(R.layout.confirm_delete);
40         getWindow().setLayout(
41                 WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
42 
43         mPrompt = (TextView) findViewById(R.id.prompt);
44         mButton = (Button) findViewById(R.id.delete);
45         mButton.setOnClickListener(mButtonClicked);
46 
47         ((Button) findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() {
48             public void onClick(View v) {
49                 finish();
50             }
51         });
52 
53         Bundle b = getIntent().getExtras();
54         String desc = b.getString("description");
55         mItemList = b.getLongArray("items");
56 
57         mPrompt.setText(desc);
58     }
59 
60     private View.OnClickListener mButtonClicked = new View.OnClickListener() {
61         public void onClick(View v) {
62             // delete the selected item(s)
63             MusicUtils.deleteTracks(DeleteItems.this, mItemList);
64             finish();
65         }
66     };
67 }
68