New UI finished, and image showing! [#2]

This commit is contained in:
ChronosX88 2019-02-08 21:50:26 +04:00
parent d513b00711
commit 846ea7be39
No known key found for this signature in database
GPG Key ID: 8F92E090A87804AA
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

View File

@ -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<String, String> mData;
private String[] mKeys;
public PropertiesListAdapter(LinkedHashMap<String, String> 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;
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/propertyNameView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Property Name"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" />
<TextView
android:id="@+id/propertyValueView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Property Value" />
</LinearLayout>