Commit 35ad9bfd authored by TwistedUmbrella's avatar TwistedUmbrella
Browse files

Fix compatibility with older Android versions with least effort

parent 20422ef8
......@@ -8,9 +8,9 @@
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#D0000000">
<ImageView
android:id="@+id/icon"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:contentDescription="@string/desc_list_item_icon"
android:src="@drawable/ic_launcher"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_toRightOf="@id/icon"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="@style/BaseText"
android:gravity="center_vertical"
android:paddingRight="40dp"/>
</RelativeLayout>
\ No newline at end of file
......@@ -34,7 +34,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:ems="12"
android:text="@string/browser"
android:textAppearance="@style/BaseText" />
</LinearLayout>
......@@ -62,7 +62,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:ems="12"
android:text="@string/settings"
android:textAppearance="@style/BaseText" />
</LinearLayout>
......@@ -90,7 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:ems="12"
android:text="@string/paths"
android:textAppearance="@style/BaseText" />
</LinearLayout>
......@@ -118,7 +118,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:ems="12"
android:text="@string/input"
android:textAppearance="@style/BaseText" />
</LinearLayout>
......@@ -146,7 +146,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:ems="12"
android:text="@string/about"
android:textAppearance="@style/BaseText" />
</LinearLayout>
......@@ -173,7 +173,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:ems="12"
android:text="@string/rateme"
android:textAppearance="@style/BaseText" />
</LinearLayout>
......
package com.reicast.emulator;
public class NavDrawerItem {
private String title;
private int icon;
public NavDrawerItem(){}
public NavDrawerItem(String title, int icon){
this.title = title;
this.icon = icon;
}
public NavDrawerItem(String title, int icon, String count){
this.title = title;
this.icon = icon;
}
public String getTitle(){
return this.title;
}
public int getIcon(){
return this.icon;
}
public void setTitle(String title){
this.title = title;
}
public void setIcon(int icon){
this.icon = icon;
}
}
\ No newline at end of file
package com.reicast.emulator;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
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 NavDrawerListAdapter extends BaseAdapter {
private Context context;
private ArrayList<NavDrawerItem> navDrawerItems;
public NavDrawerListAdapter(Context context, ArrayList<NavDrawerItem> navDrawerItems){
this.context = context;
this.navDrawerItems = navDrawerItems;
}
public int getCount() {
return navDrawerItems.size();
}
public Object getItem(int position) {
return navDrawerItems.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater)
context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.drawer_list_item, null);
}
ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
imgIcon.setImageResource(navDrawerItems.get(position).getIcon());
txtTitle.setText(navDrawerItems.get(position).getTitle());
return convertView;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment