List of usage examples for android.view Window setContentView
public abstract void setContentView(View view);
From source file:de.hu_berlin.informatik.spws2014.mapever.BaseActivity.java
private void showAboutUsPopup() { aboutUsPopup.show(); Window win = aboutUsPopup.getWindow(); win.setContentView(R.layout.aboutus); }
From source file:com.cleanwiz.applock.ui.activity.SplashActivity.java
public void showUpdateDialog(String intro) { final AlertDialog updateDialogDlg = new AlertDialog.Builder(this).create(); updateDialogDlg.show();//from w w w. ja va 2 s.com Window win = updateDialogDlg.getWindow(); win.setContentView(R.layout.dialog_update); TextView tvMsg = (TextView) win.findViewById(R.id.tvMsg); tvMsg.setText(intro); Button btOk = (Button) win.findViewById(R.id.btOk); ImageView closeImageView = (ImageView) win.findViewById(R.id.updateclose); closeImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub updateDialogDlg.dismiss(); SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); btOk.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_DOWN; handler.sendMessage(msg); } }); updateDialogDlg.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { // TODO Auto-generated method stub List<UpdateVersionManafer> updateVersionManafers = updateVersionManagerService.getVersionManafers(); for (UpdateVersionManafer updateVersionManafer : updateVersionManafers) { updateVersionManafer.setLasttipdate(new Date().getTime()); updateVersionManagerService.modifyTipsDate(updateVersionManafer); break; } SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); }
From source file:com.xuejian.client.lxp.module.toolbox.im.IMMainActivity.java
private void showActionDialog() { final Activity act = this; final AlertDialog dialog = new AlertDialog.Builder(act).create(); View contentView = View.inflate(act, R.layout.dialog_city_detail_action, null); Button btn = (Button) contentView.findViewById(R.id.btn_go_plan); btn.setText("Talk"); btn.setOnClickListener(new View.OnClickListener() { @Override/* www. j av a 2 s . co m*/ public void onClick(View view) { MobclickAgent.onEvent(mContext, "event_create_new_talk"); startActivityForResult(new Intent(IMMainActivity.this, PickContactsWithCheckboxActivity.class) .putExtra("request", NEW_CHAT_REQUEST_CODE), NEW_CHAT_REQUEST_CODE); dialog.dismiss(); } }); Button btn1 = (Button) contentView.findViewById(R.id.btn_go_share); btn1.setText("?"); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { MobclickAgent.onEvent(mContext, "event_add_new_friend"); startActivity(new Intent(IMMainActivity.this, AddContactActivity.class)); dialog.dismiss(); } }); contentView.findViewById(R.id.btn_cancle).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); WindowManager windowManager = act.getWindowManager(); Window window = dialog.getWindow(); window.setContentView(contentView); Display display = windowManager.getDefaultDisplay(); WindowManager.LayoutParams lp = window.getAttributes(); lp.width = (int) (display.getWidth()); // window.setAttributes(lp); window.setGravity(Gravity.BOTTOM); // ?dialog? window.setWindowAnimations(R.style.SelectPicDialog); // }
From source file:ab.util.AbDialogUtil.java
/** * AlertDialog ??/*from ww w . j ava 2 s . c om*/ */ public static AlertDialog getAlertDialogWithoutRemove(Context mContext, int layout, double showWidth) { final AlertDialog alerDialog = new AlertDialog.Builder(mContext).create(); alerDialog.show(); alerDialog.setCanceledOnTouchOutside(true); Window window = alerDialog.getWindow(); // ?? int height = ScreenUtils.getScreenHeight(mContext); int width = ScreenUtils.getScreenWidth(mContext); WindowManager.LayoutParams params = window.getAttributes(); params.width = (int) (width * showWidth); params.gravity = Gravity.CENTER_HORIZONTAL; alerDialog.onWindowAttributesChanged(params); window.setContentView(layout); return alerDialog; }
From source file:com.hx.hxchat.activity.ChatHistoryFragment.java
/** * /*from w w w . ja v a 2 s. c o m*/ * @param title * @param emContact */ private void showMyDialog(String title, final ChatHistoryAdapter adapter, final int position) { final AlertDialog dlg = new AlertDialog.Builder(context).create(); dlg.show(); Window window = dlg.getWindow(); // ??,shrew_exit_dialog.xmlview window.setContentView(R.layout.alertdialog); window.findViewById(R.id.ll_title).setVisibility(View.VISIBLE); TextView tv_title = (TextView) window.findViewById(R.id.tv_title); tv_title.setText(title); TextView tv_content1 = (TextView) window.findViewById(R.id.tv_content1); final String username = adapter.getItem(position).getUsername(); // ?? if (topMap.containsKey(username)) { tv_content1.setText("?"); } else { tv_content1.setText("?"); } tv_content1.setOnClickListener(new View.OnClickListener() { @SuppressLint("SdCardPath") public void onClick(View v) { if (topMap.containsKey(username)) { topMap.remove(username); TopUserDao topUserDao = new TopUserDao(context); topUserDao.deleteTopUser(username); } else { TopUser topUser = new TopUser(); topUser.setTime(System.currentTimeMillis()); // 1--- topUser.setType(1); topUser.setUserName(username); Map<String, TopUser> map = new HashMap<String, TopUser>(); map.put(adapter.getItem(position).getUsername(), topUser); topMap.putAll(map); TopUserDao topUserDao = new TopUserDao(context); topUserDao.saveTopUser(topUser); } refresh(); dlg.cancel(); } }); TextView tv_content2 = (TextView) window.findViewById(R.id.tv_content2); tv_content2.setText("?"); tv_content2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { EMContact tobeDeleteUser = adapter.getItem(position); EMChatManager.getInstance().deleteConversation(adapter.getItem(position).getUsername()); InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(context); inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername()); BaseApplication.getApplication().GetLinkerDao().deleteContact(tobeDeleteUser.getUsername()); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); // ((MainActivity) context).homefragment.refresh(); // boolean isGroup = false; // // // if (tobeDeleteUser instanceof EMGroup) // isGroup = true; // // // ? // boolean deleteConversation = EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername()); // InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity()); // inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername()); // // BaseApplication.getApplication().GetLinkerDao().deleteContact(tobeDeleteUser.getUsername()); // adapter.remove(tobeDeleteUser); // adapter.notifyDataSetChanged(); // // // ? // // TODO // // ((MainActivity) getActivity()).updateUnreadLabel(); // // // dlg.cancel(); } }); }
From source file:com.processing.core.PApplet.java
/** Called with the activity is first created. */ @Override//from www.jav a 2 s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // println("PApplet.onCreate()"); if (DEBUG) println("onCreate() happening here: " + Thread.currentThread().getName()); Window window = getWindow(); // Take up as much area as possible requestWindowFeature(Window.FEATURE_NO_TITLE); window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); // This does the actual full screen work window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); displayWidth = dm.widthPixels; displayHeight = dm.heightPixels; // println("density is " + dm.density); // println("densityDpi is " + dm.densityDpi); if (DEBUG) println("display metrics: " + dm); //println("screen size is " + screenWidth + "x" + screenHeight); // LinearLayout layout = new LinearLayout(this); // layout.setOrientation(LinearLayout.VERTICAL | LinearLayout.HORIZONTAL); // viewGroup = new ViewGroup(); // surfaceView.setLayoutParams(); // viewGroup.setLayoutParams(LayoutParams.) // RelativeLayout layout = new RelativeLayout(this); // RelativeLayout overallLayout = new RelativeLayout(this); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT); //lp.addRule(RelativeLayout.RIGHT_OF, tv1.getId()); // layout.setGravity(RelativeLayout.CENTER_IN_PARENT); int sw = sketchWidth(); int sh = sketchHeight(); if (sketchRenderer().equals(JAVA2D)) { surfaceView = new SketchSurfaceView(this, sw, sh); } else if (sketchRenderer().equals(P2D) || sketchRenderer().equals(P3D)) { surfaceView = new SketchSurfaceViewGL(this, sw, sh, sketchRenderer().equals(P3D)); } // g = ((SketchSurfaceView) surfaceView).getGraphics(); // surfaceView.setLayoutParams(new LayoutParams(sketchWidth(), sketchHeight())); // layout.addView(surfaceView); // surfaceView.setVisibility(1); // println("visibility " + surfaceView.getVisibility() + " " + SurfaceView.VISIBLE); // layout.addView(surfaceView); // AttributeSet as = new AttributeSet(); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(layout, as); // lp.addRule(android.R.styleable.ViewGroup_Layout_layout_height, // layout.add //lp.addRule(, arg1) //layout.addView(surfaceView, sketchWidth(), sketchHeight()); // new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, // RelativeLayout.LayoutParams.FILL_PARENT); if (sw == displayWidth && sh == displayHeight) { // If using the full screen, don't embed inside other layouts window.setContentView(surfaceView); } else { // If not using full screen, setup awkward view-inside-a-view so that // the sketch can be centered on screen. (If anyone has a more efficient // way to do this, please file an issue on Google Code, otherwise you // can keep your "talentless hack" comments to yourself. Ahem.) RelativeLayout overallLayout = new RelativeLayout(this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); LinearLayout layout = new LinearLayout(this); layout.addView(surfaceView, sketchWidth(), sketchHeight()); overallLayout.addView(layout, lp); window.setContentView(overallLayout); } /* // Here we use Honeycomb API (11+) to hide (in reality, just make the status icons into small dots) // the status bar. Since the core is still built against API 7 (2.1), we use introspection to get // the setSystemUiVisibility() method from the view class. Method visibilityMethod = null; try { visibilityMethod = surfaceView.getClass().getMethod("setSystemUiVisibility", new Class[] { int.class}); } catch (NoSuchMethodException e) { // Nothing to do. This means that we are running with a version of Android previous to Honeycomb. } if (visibilityMethod != null) { try { // This is equivalent to calling: //surfaceView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN); // The value of View.STATUS_BAR_HIDDEN is 1. visibilityMethod.invoke(surfaceView, new Object[] { 1 }); } catch (InvocationTargetException e) { } catch (IllegalAccessException e) { } } window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); */ // layout.addView(surfaceView, lp); // surfaceView.setLayoutParams(new LayoutParams(sketchWidth(), sketchHeight())); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams() // layout.addView(surfaceView, new LayoutParams(arg0) // TODO probably don't want to set these here, can't we wait for surfaceChanged()? // removing this in 0187 // width = screenWidth; // height = screenHeight; // int left = (screenWidth - iwidth) / 2; // int right = screenWidth - (left + iwidth); // int top = (screenHeight - iheight) / 2; // int bottom = screenHeight - (top + iheight); // surfaceView.setPadding(left, top, right, bottom); // android:layout_width // window.setContentView(surfaceView); // set full screen // code below here formerly from init() //millisOffset = System.currentTimeMillis(); // moved to the variable declaration finished = false; // just for clarity // this will be cleared by draw() if it is not overridden looping = true; redraw = true; // draw this guy once // firstMotion = true; Context context = getApplicationContext(); sketchPath = context.getFilesDir().getAbsolutePath(); // Looper.prepare(); handler = new Handler(); // println("calling loop()"); // Looper.loop(); // println("done with loop() call, will continue..."); start(); }