private void showDialog() {
View view = getLayoutInflater().inflate(R.layout.user_header_dialog, null);
final Dialog dialog = new Dialog(this, R.style.transparentFrameWindowStyle);
dialog.setContentView(view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Window window = dialog.getWindow();
// 设置显示动画
window.setWindowAnimations(R.style.main_menu_animstyle);
WindowManager.LayoutParams wl = window.getAttributes();
wl.x = 0;
wl.y = getWindowManager().getDefaultDisplay().getHeight();
// 以下这两句是为了保证按钮可以水平满屏
wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
// 设置显示位置
dialog.onWindowAttributesChanged(wl);
// 设置点击外围解散
dialog.setCanceledOnTouchOutside(true);
dialog.show();
btn_picture = (Button) window.findViewById(R.id.btn_picture);
btn_photo = (Button) window.findViewById(R.id.btn_photo);
btn_cancle = (Button) window.findViewById(R.id.btn_cancle);
btn_picture.setOnClickListener(new View.OnClickListener() {// 图库
@SuppressLint("InlinedApi")
@Override
public void onClick(View v) {
Intent intent = new Intent(PhotoSelectActivity.this, AlbumActivity.class);
startActivity(intent);
dialog.dismiss();
}
});
btn_photo.setOnClickListener(new View.OnClickListener() {// 相机
@SuppressLint("InlinedApi")
@Override
public void onClick(View v) {
photo();
dialog.dismiss();
}
});
btn_cancle.setOnClickListener(new View.OnClickListener() {// 取消
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case TAKE_PICTURE:
if (Bimp.tempSelectBitmap.size() < 9 && resultCode == RESULT_OK) {
File file = new File(Environment.getExternalStorageDirectory() + "/" + mImageFileName);
mImagePath = file.getPath();
Bitmap bitmapFromUrl = FileUtils.getBitmapFromUrl(mImagePath, 320, 480);
String[] split = mImagePath.split("0/");
String strUrl = "";
if (split != null && split.length > 0) {
strUrl = split[1];
}
// 重新缓存图片
FileUtils.setPicToView(PhotoSelectActivity.this,bitmapFromUrl, strUrl);
// 获取重新缓存图片的大小
File iconDir = FileUtils.getIconDir(PhotoSelectActivity.this);
String absolutePath = iconDir.getAbsolutePath();
String picPath = absolutePath + strUrl;
ImageItem takePhoto = new ImageItem();
takePhoto.setBitmap(bitmapFromUrl);
takePhoto.setImagePath(picPath);
Bimp.tempSelectBitmap.add(takePhoto);
}
break;
}
}
/**
* 清空图片集合
*/
private void cleanImageList() {
Bimp.max = 0;
Bimp.tempSelectBitmap.clear();
}
private void initPow() {
View view = getLayoutInflater().inflate(R.layout.listview_popupwindows, null);
final Dialog dialog = new Dialog(this, R.style.Dialog_Fullscreen);
dialog.setContentView(view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Window window = dialog.getWindow();
// 设置显示动画
window.setWindowAnimations(R.style.main_menu_animstyle);
WindowManager.LayoutParams wl = window.getAttributes();
wl.x = 0;
wl.y = getWindowManager().getDefaultDisplay().getHeight();
int height = 0;
int h=(int) (mScreenHeight / 1.6);
int listH=AlbumActivity.contentList.size()*DensityUtil.dip2px(AlbumActivity.this,80);
if (listH==0) {
height=h;
}else{
if (listH>h) {
height=h;
}else{
height=listH;
}
}
// 以下这两句是为了保证按钮可以水平满屏
wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
wl.height = height;
// 设置显示位置
dialog.onWindowAttributesChanged(wl);
// 设置点击外围解散
dialog.setCanceledOnTouchOutside(true);
dialog.show();
ListView listview = (ListView) window.findViewById(R.id.listview);
ListAdapter listAdapter = new ListAdapter(AlbumActivity.this);
listview.setAdapter(listAdapter);
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
dataList = (ArrayList<ImageItem>) AlbumActivity.contentList.get(arg2).imageList;
String folderName = AlbumActivity.contentList.get(arg2).bucketName;
tv_all.setText("" + folderName);
gridImageAdapter = new AlbumGridViewAdapter(AlbumActivity.this, dataList, Bimp.tempSelectBitmap);
agridView.setAdapter(gridImageAdapter);
dialog.dismiss();
}
});
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有