Home | History | Annotate | Download | only in am
      1 package com.android.server.am;
      2 
      3 import com.android.internal.R;
      4 
      5 import android.app.Dialog;
      6 import android.content.Context;
      7 import android.view.Window;
      8 import android.view.WindowManager;
      9 import android.widget.ImageView;
     10 import android.widget.TextView;
     11 
     12 public class LaunchWarningWindow extends Dialog {
     13     public LaunchWarningWindow(Context context, ActivityRecord cur, ActivityRecord next) {
     14         super(context, R.style.Theme_Toast);
     15 
     16         requestWindowFeature(Window.FEATURE_LEFT_ICON);
     17         getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
     18         getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
     19                 | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
     20 
     21         setContentView(R.layout.launch_warning);
     22         setTitle(context.getText(R.string.launch_warning_title));
     23         getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
     24                 R.drawable.ic_dialog_alert);
     25         ImageView icon = (ImageView)findViewById(R.id.replace_app_icon);
     26         icon.setImageDrawable(next.info.applicationInfo.loadIcon(context.getPackageManager()));
     27         TextView text = (TextView)findViewById(R.id.replace_message);
     28         text.setText(context.getResources().getString(R.string.launch_warning_replace,
     29                 next.info.applicationInfo.loadLabel(context.getPackageManager()).toString()));
     30         icon = (ImageView)findViewById(R.id.original_app_icon);
     31         icon.setImageDrawable(cur.info.applicationInfo.loadIcon(context.getPackageManager()));
     32         text = (TextView)findViewById(R.id.original_message);
     33         text.setText(context.getResources().getString(R.string.launch_warning_original,
     34                 cur.info.applicationInfo.loadLabel(context.getPackageManager()).toString()));
     35     }
     36 }
     37