From 846ea7be393e4428580397e56b249b08c2d2edce Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Fri, 8 Feb 2019 21:50:26 +0400 Subject: [PATCH] New UI finished, and image showing! [#2] --- .idea/render.experimental.xml | 6 +++ .../additional/PropertiesListAdapter.java | 52 +++++++++++++++++++ .../res/layout/properties_list_adapter.xml | 19 +++++++ 3 files changed, 77 insertions(+) create mode 100644 .idea/render.experimental.xml create mode 100644 app/src/main/java/ru/volgorobot/vrcatalog/additional/PropertiesListAdapter.java create mode 100644 app/src/main/res/layout/properties_list_adapter.xml diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml new file mode 100644 index 0000000..8ec256a --- /dev/null +++ b/.idea/render.experimental.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/java/ru/volgorobot/vrcatalog/additional/PropertiesListAdapter.java b/app/src/main/java/ru/volgorobot/vrcatalog/additional/PropertiesListAdapter.java new file mode 100644 index 0000000..15941d7 --- /dev/null +++ b/app/src/main/java/ru/volgorobot/vrcatalog/additional/PropertiesListAdapter.java @@ -0,0 +1,52 @@ +package ru.volgorobot.vrcatalog.additional; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +import java.util.LinkedHashMap; + +import ru.volgorobot.vrcatalog.R; + +public class PropertiesListAdapter extends BaseAdapter { + private LinkedHashMap mData; + private String[] mKeys; + + public PropertiesListAdapter(LinkedHashMap data) { + mData = data; + mKeys = mData.keySet().toArray(new String[data.size()]); + } + + @Override + public int getCount() { + return mData.size(); + } + + @Override + public Object getItem(int position) { + return mData.get(mKeys[position]); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + final View result; + + if (convertView == null) { + result = LayoutInflater.from(parent.getContext()).inflate(R.layout.properties_list_adapter, parent, false); + } else { + result = convertView; + } + + ((TextView) result.findViewById(R.id.propertyNameView)).setText(mKeys[position]); + ((TextView) result.findViewById(R.id.propertyValueView)).setText(getItem(position).toString()); + + return result; + } +} diff --git a/app/src/main/res/layout/properties_list_adapter.xml b/app/src/main/res/layout/properties_list_adapter.xml new file mode 100644 index 0000000..45011c0 --- /dev/null +++ b/app/src/main/res/layout/properties_list_adapter.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file