/* libtiffdecoder A tiff decoder run on android system. Copyright (C) 2009 figofuture
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later
* version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* */
package android.widget;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import com.tiffviewer.R;
import android.app.ListActivity;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
public abstract class FileDialog extends ListActivity {
private final static String LOG_TAG = "FileDialog";
/**
* text we use for the parent directory
*/
private final static String PARENT_DIR = "..";
/**
* Currently displayed files
*/
private final List<String> mCurrentFiles = new ArrayList<String>();
/**
* Currently displayed directory
*/
private File mCurrentDir = null;
public void onPostFileAccessIntent( final File file)
{
}
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
// go to the root directory
try {
showDirectory("/");
} catch (NullPointerException e) {
showDirectory("/");
}
getListView().setSelector(getResources().getDrawable(R.drawable.bk_listitem_focus));
}
protected void onListItemClick(final ListView l, final View v, final int position, final long id) {
if (position == 0 && PARENT_DIR.equals(this.mCurrentFiles.get(0))) {
showDirectory(this.mCurrentDir.getParent());
} else {
final File file = new File(this.mCurrentFiles.get(position));
if (file.isDirectory()) {
showDirectory(file.getAbsolutePath());
} else {
onPostFileAccessIntent(file);
}
}
}
/**
* Show the contents of a given directory as a selectable list
*
* @param path the directory to display
*/
private void showDirectory(final String path) {
// we clear any old content and add an entry to get up one level
this.mCurrentFiles.clear();
this.mCurrentDir = new File(path);
if (this.mCurrentDir.getParentFile() != null) {
this.mCurrentFiles.add(PARENT_DIR);
}
// get all directories and files in the given path
final File[] files = this.mCurrentDir.listFiles();
//if( null == files )
//return;
final Set<String> sorted = new TreeSet<String>();
if ( null != files ){
for (final File file : files) {
final String name = file.getAbsolutePath();
if (file.isDirectory()) {
sorted.add(name);
} else {
final String extension = name.indexOf('.') > 0 ? name.substring(name.lastIndexOf('.') + 1) : "";
if (null == getAcceptedFileTypes() || getAcceptedFileTypes().contains(extension.toLowerCase())) {
sorted.add(name);
}
}
}
this.mCurrentFiles.addAll(sorted);
}
// display these images
final Context context = this;
ArrayAdapter<String> filenamesAdapter = new ArrayAdapter<String>(this, getTextView(), this.mCurrentFiles) {
public View getView(final int position, final View convertView, final ViewGroup parent) {
return new IconifiedTextLayout(context, getItem(position), position);
}
};
setListAdapter(filenamesAdapter);
}
// new layout displaying a text and an associated image
class IconifiedTextLayout extends LinearLayout {
public IconifiedTextLayout(final Context context, final String path, final int position) {
super(context);
setOrientation(HORIZONTAL);
// determine icon to display
final ImageView imageView = new ImageView(context);
final File file = new File(path);
if (position == 0 && PARENT_DIR.equals(path)) {
imageView.setImageResource(getParentFolderImage());
} else {
if (file.isDirectory()) {
if( file.getName().equalsIgnoreCase("system") || file.getName().equalsIgnoreCase("data"))
imageView.setImageResource(getInternalStorageImage());
else if (file.getName().equalsIgnoreCase("sdcard"))
imageView.setImageResource(getExternalStorageImage());
else
imageView.setImageResource(getFolderImage());
} else {
imageView.setImageResource(getFileImage());
}
}
imageView.setPadding(0, 1, 5, 0);
// create view for the directory name
final TextView textView = new TextView(context);
textView.setText(file.getName());
Resources resources = getBaseContext().getResources();
textView.setTextColor(resources.getColor(R.color.tab_tag_text_focus));
textView.setGravity(Gravity.CENTER);
textView.setTextSize(24);
addView(imageView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addView(textView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT));
}
}
// methods to be implemented by subclasses
/**
* Get the list of file extensions which are accepted by the file dialog
*
* @return null to accept all files, or a list of lowercase file extensions
*/
public abstract List<String> getAcceptedFileTypes();
/**
* Get the TextView resource used for the TextView inside the list
*
* @return layout resource id
*/
public abstract int getTextView();
/**
* Get the image used for navigating to the parent folder
*
* @return image resource id
*/
public abstract int getParentFolderImage();
/**
* Get the image denoting a folder
*
* @return image resource id
*/
public abstract int getFolderImage();
/**
* Get the image denoting a file to select
*
* @return image resource id
*/
public abstract int getFileImage();
public abstract int getExternalStorageImage();
public abstract int getInternalStorageImage();
}
没有合适的资源?快使用搜索试试~ 我知道了~
android tif 解析 bitmap 工程
共605个文件
html:113个
c:106个
d:40个
4星 · 超过85%的资源 需积分: 34 110 下载量 13 浏览量
2012-09-05
08:57:18
上传
评论 2
收藏 3.95MB RAR 举报
温馨提示
一个完整的解析tif文件的android工程,可以将tif文件转换成bitmap,以供查看,已经生成了so包,所以TiffDecoder.java的包名不要修改,否则会出异常。做tif查看由于android不包含java.awt包,所以jai.jar不能用,这是找了半天最好的方法了。
资源推荐
资源详情
资源评论
收起资源包目录
android tif 解析 bitmap 工程 (605个子文件)
tiffcrop.1 23KB
tiffcp.1 8KB
fax2tiff.1 8KB
tiff2pdf.1 7KB
tiff2ps.1 7KB
tiffgt.1 7KB
raw2tiff.1 5KB
fax2ps.1 5KB
tiffsv.1 4KB
tiffdither.1 4KB
tiff2rgba.1 3KB
tiffmedian.1 3KB
pal2rgb.1 3KB
rgb2ycbcr.1 3KB
ras2tiff.1 3KB
ppm2tiff.1 3KB
thumbnail.1 3KB
tiffdump.1 3KB
tiffcmp.1 3KB
sgi2tiff.1 3KB
tiff2bw.1 3KB
bmp2tiff.1 3KB
tiffinfo.1 3KB
gif2tiff.1 3KB
tiffset.1 2KB
tiffsplit.1 2KB
libtiff.3tiff 18KB
TIFFOpen.3tiff 9KB
TIFFRGBAImage.3tiff 9KB
TIFFGetField.3tiff 8KB
TIFFcolor.3tiff 8KB
TIFFSetField.3tiff 7KB
TIFFReadRGBAImage.3tiff 7KB
TIFFReadDirectory.3tiff 6KB
TIFFReadRGBATile.3tiff 6KB
TIFFReadRGBAStrip.3tiff 6KB
TIFFWriteScanline.3tiff 6KB
TIFFWriteDirectory.3tiff 5KB
TIFFquery.3tiff 4KB
TIFFtile.3tiff 4KB
TIFFReadScanline.3tiff 4KB
TIFFstrip.3tiff 4KB
TIFFWriteEncodedStrip.3tiff 4KB
TIFFWriteEncodedTile.3tiff 3KB
TIFFbuffer.3tiff 3KB
TIFFWriteRawStrip.3tiff 3KB
TIFFReadTile.3tiff 3KB
TIFFcodec.3tiff 3KB
TIFFReadEncodedStrip.3tiff 3KB
TIFFReadEncodedTile.3tiff 3KB
TIFFWriteRawTile.3tiff 3KB
TIFFmemory.3tiff 3KB
TIFFswab.3tiff 3KB
TIFFSetDirectory.3tiff 3KB
TIFFWriteTile.3tiff 3KB
TIFFWarning.3tiff 3KB
TIFFError.3tiff 3KB
TIFFReadRawTile.3tiff 3KB
TIFFPrintDirectory.3tiff 3KB
TIFFFlush.3tiff 2KB
TIFFReadRawStrip.3tiff 2KB
TIFFsize.3tiff 2KB
TIFFDataWidth.3tiff 2KB
TIFFClose.3tiff 2KB
libjpeg.a 1.83MB
configure.ac 24KB
Makefile.acorn 5KB
Makefile.am 4KB
Makefile.am 3KB
Makefile.am 3KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
README.android 154B
resources.ap_ 88KB
com.tiffviewer.TiffDecoderActivity.apk 339KB
tiffcrop.c 286KB
tiff2pdf.c 156KB
tif_fax3sm.c 102KB
tif_ojpeg.c 73KB
tif_getimage.c 67KB
tiff2ps.c 67KB
共 605 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
ruizhi6666
- 粉丝: 4
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页