mirror of https://github.com/perkeep/perkeep.git
android: add icons for files and directories
trying to get the hang of making stuff in inkscape that doesn't look awful
This commit is contained in:
parent
a1d768f46d
commit
58c678e94e
Binary file not shown.
After Width: | Height: | Size: 640 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,11 +1,23 @@
|
|||
<!-- cribbed from simple_list_item_1 -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/title"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="6dip"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:paddingLeft="6dip"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -148,6 +149,18 @@ public class BrowseActivity extends ListActivity {
|
|||
|
||||
Entry entry = mEntries.get(position);
|
||||
((TextView) view.findViewById(R.id.title)).setText(entry.toString());
|
||||
|
||||
ImageView icon = ((ImageView) view.findViewById(R.id.icon));
|
||||
switch (entry.getType()) {
|
||||
case DIRECTORY:
|
||||
icon.setImageResource(R.drawable.icon_folder);
|
||||
break;
|
||||
case FILE:
|
||||
icon.setImageResource(R.drawable.icon_file);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue