/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.music; import android.app.Activity; import android.media.AudioManager; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; public class DeleteItems extends Activity { private TextView mPrompt; private Button mButton; private long [] mItemList; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setVolumeControlStream(AudioManager.STREAM_MUSIC); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.confirm_delete); getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT); mPrompt = (TextView)findViewById(R.id.prompt); mButton = (Button) findViewById(R.id.delete); mButton.setOnClickListener(mButtonClicked); ((Button)findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); Bundle b = getIntent().getExtras(); String desc = b.getString("description"); mItemList = b.getLongArray("items"); mPrompt.setText(desc); } private View.OnClickListener mButtonClicked = new View.OnClickListener() { public void onClick(View v) { // delete the selected item(s) MusicUtils.deleteTracks(DeleteItems.this, mItemList); finish(); } }; }