diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-01-21 12:54:06 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-01-21 16:43:19 +0000 |
commit | 5822ff1619fda7f0cc0b10f77d351eb459e3c67c (patch) | |
tree | bde594a8cd36b72bc7c698ab3eec3861a1802b9f /android/src/com/artifex/mupdfdemo/ChoosePDFAdapter.java | |
parent | 18d50b1c3ddfef1b08059a3fc898dad0fb98d6a7 (diff) | |
download | mupdf-5822ff1619fda7f0cc0b10f77d351eb459e3c67c.tar.xz |
Rename app.
Due to a clash on Google Play, we need to rename the apps main
class from com.artifex.mupdf to something else. We choose
com.artifex.mupdfdemo. Any user of the code in their own app
should rename it similarly. To simplify this process we add
some macros in the C.
Various renames and lots of tedious package name editing is still
required in the Java though.
Diffstat (limited to 'android/src/com/artifex/mupdfdemo/ChoosePDFAdapter.java')
-rw-r--r-- | android/src/com/artifex/mupdfdemo/ChoosePDFAdapter.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/android/src/com/artifex/mupdfdemo/ChoosePDFAdapter.java b/android/src/com/artifex/mupdfdemo/ChoosePDFAdapter.java new file mode 100644 index 00000000..c26174a2 --- /dev/null +++ b/android/src/com/artifex/mupdfdemo/ChoosePDFAdapter.java @@ -0,0 +1,64 @@ +package com.artifex.mupdfdemo; + +import java.util.LinkedList; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +public class ChoosePDFAdapter extends BaseAdapter { + private final LinkedList<ChoosePDFItem> mItems; + private final LayoutInflater mInflater; + + public ChoosePDFAdapter(LayoutInflater inflater) { + mInflater = inflater; + mItems = new LinkedList<ChoosePDFItem>(); + } + + public void clear() { + mItems.clear(); + } + + public void add(ChoosePDFItem item) { + mItems.add(item); + notifyDataSetChanged(); + } + + public int getCount() { + return mItems.size(); + } + + public Object getItem(int i) { + return null; + } + + public long getItemId(int arg0) { + return 0; + } + + private int iconForType(ChoosePDFItem.Type type) { + switch (type) { + case PARENT: return R.drawable.ic_arrow_up; + case DIR: return R.drawable.ic_dir; + case DOC: return R.drawable.ic_doc; + default: return 0; + } + } + + public View getView(int position, View convertView, ViewGroup parent) { + View v; + if (convertView == null) { + v = mInflater.inflate(R.layout.picker_entry, null); + } else { + v = convertView; + } + ChoosePDFItem item = mItems.get(position); + ((TextView)v.findViewById(R.id.name)).setText(item.name); + ((ImageView)v.findViewById(R.id.icon)).setBackgroundResource(iconForType(item.type)); + return v; + } + +} |