Commit b0f20882 authored by Schoumi's avatar Schoumi

Big refactoring

Fragment instead of activity
OSM instead of GMaps
Remove old code to replace by newer implementation
Fix warnings
parent 2985520c
app/build/*
build/*
.gradle/*
.idea/*
gradle/*
gradlew*
import-summary.txt
*.apk
# Generated files
bin/
gen/
# Gradle files
.gradle/
build/
/*/build/
gradlew*
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
#android-studio file
.idea
*.iml
captures/
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="BloodDonation" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="play-services-plus-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-cast-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-maps-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-7.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-fitness-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-panorama-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-safetynet-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-location-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-identity-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-appstate-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-drive-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-games-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-appindexing-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-7.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-nearby-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-wearable-7.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-wallet-7.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
</component>
</module>
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "fr.mobdev.blooddonation"
minSdkVersion 11
targetSdkVersion 21
minSdkVersion 17
targetSdkVersion 26
versionCode = "8"
versionName = "3.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.github.car2go.AnyMaps:anymaps-base:6.0.0'
compile 'com.github.car2go.AnyMaps:anymaps-osm:6.0.0'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.mobdev.blooddonation"
android:versionCode="7"
android:versionName="2.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
>
<supports-screens
android:largeScreens="false"
......@@ -19,63 +14,29 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-feature android:name="android.hardware.location.gps"/>
<application
android:name=".App"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library
android:name="com.google.android.maps"
android:required="false" />
<!-- google Maps API -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBtxQBjEu5XZ0Gw_ObqTx-iCaCsLth4Id8" />
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" >
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.AboutActivity"
android:parentActivityName=".activity.MainActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.PrefsActivity"
android:parentActivityName=".activity.MainActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.DonationActivity"
android:parentActivityName=".activity.MainActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.DonationInfoActivity"
android:parentActivityName=".activity.MainActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
......@@ -87,12 +48,6 @@
</receiver>
<receiver android:name=".service.AlarmReceiver" />
<activity
android:name=".activity.NotificationsActivity"
android:label="@string/title_activity_notifications"
android:parentActivityName=".activity.MainActivity"
android:screenOrientation="portrait">
</activity>
</application>
</manifest>
\ No newline at end of file
package fr.mobdev.blooddonation;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
import android.app.Application;
public class App extends Application {
private Tracker tracker;
public void onCreate(){
super.onCreate();
tracker = null;
getTracker();
}
synchronized Tracker getTracker() {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
if(tracker == null)
tracker = analytics.newTracker(R.xml.analytics);
return tracker;
}
}
......@@ -20,13 +20,15 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
import android.util.Log;
import com.car2go.maps.model.LatLng;
import fr.mobdev.blooddonation.enums.Country;
import fr.mobdev.blooddonation.enums.SiteType;
import fr.mobdev.blooddonation.objects.BloodSite;
import fr.mobdev.blooddonation.objects.LatiLng;
public class NetworkManager {
//TODO Complete rework with thread and message Queue
private NetworkListener listener;
private static NetworkManager instance;
private Context context;
......@@ -37,7 +39,7 @@ public class NetworkManager {
{
this.listener = listener;
this.context = context;
idList = new ArrayList<Integer>();
idList = new ArrayList<>();
}
public static NetworkManager getInstance(NetworkListener listener, Context context){
......@@ -58,7 +60,7 @@ public class NetworkManager {
this.listener = listener;
}
public void loadFromNet(final Country ctr,final LatiLng nECorner, final LatiLng sWCorner)
public void loadFromNet(final Country ctr, final LatLng nECorner, final LatLng sWCorner)
{
if(!isConnectedToInternet(context))
return;
......@@ -81,9 +83,9 @@ public class NetworkManager {
}).start();
}
public List<BloodSite> loadFrenchData(LatiLng nECorner, LatiLng sWCorner)
private List<BloodSite> loadFrenchData(LatLng nECorner, LatLng sWCorner)
{
List<BloodSite> siteList = new ArrayList<BloodSite>();
List<BloodSite> siteList = new ArrayList<>();
String urlstr = "http://carte.dondusang.com/gmap_regionchanged.php?"
+"nelat="+nECorner.latitude
+"&nelon="+nECorner.longitude
......@@ -98,7 +100,7 @@ public class NetworkManager {
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
URLConnection connect = null;
URLConnection connect;
InputStream stream = null;
try {
if(isConnectedToInternet(context))
......@@ -245,7 +247,7 @@ public class NetworkManager {
newSite.setSiteId(siteId);
newSite.setDate(date);
newSite.setSiteName(siteName);
newSite.setLoc(new LatiLng(latitude,longitude));
newSite.setLoc(new LatLng(latitude,longitude));
newSite.setType(type);
newSite.setCityName(cityName);
newSite.setPhone(phone);
......
......@@ -3,5 +3,5 @@ package fr.mobdev.blooddonation;
import java.util.EventListener;
public interface NewDonationListener extends EventListener {
public void needUpdate();
void needUpdate();
}
package fr.mobdev.blooddonation.activity;
import com.google.android.gms.analytics.GoogleAnalytics;
import fr.mobdev.blooddonation.R;
import android.app.Activity;
import android.os.Bundle;
public class AboutActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
getActionBar().setTitle(R.string.about);
}
@Override
public void onStart() {
super.onStart();
GoogleAnalytics.getInstance(this).reportActivityStart(this);
}
@Override
public void onStop() {
super.onStop();
GoogleAnalytics.getInstance(this).reportActivityStop(this);
}
}
package fr.mobdev.blooddonation.activity;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import com.google.android.gms.analytics.GoogleAnalytics;
import fr.mobdev.blooddonation.Database;
import fr.mobdev.blooddonation.NewDonationListener;
import fr.mobdev.blooddonation.R;
import fr.mobdev.blooddonation.SelectionModeListener;
import fr.mobdev.blooddonation.custom_object.DrawerAdapter;
import fr.mobdev.blooddonation.custom_object.DrawerItem;
import fr.mobdev.blooddonation.dialog.AddDonationDialog;
import fr.mobdev.blooddonation.enums.DrawerItemType;
import fr.mobdev.blooddonation.objects.Donation;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemLongClickListener;
public class DonationActivity extends FragmentActivity {
ListView donation_list;
List<Donation> donations;
SelectionModeListener listener;
boolean isOnSelection;
List<DrawerItem> items;
MenuItem del_item;
Context context;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.donation);
donation_list = (ListView) findViewById(R.id.donation_list);
items = new ArrayList<DrawerItem>();
isOnSelection = false;
context = this;
listener = new SelectionModeListener() {
@Override
public void selectionModeChange(View v) {
isOnSelection = !isOnSelection;
if(isOnSelection)
{
for(DrawerItem item:items)
{
item.setType(DrawerItemType.STATE_CHECK);
}
selectView(v);
del_item.setVisible(true);
DrawerAdapter adapter = new DrawerAdapter(context,R.layout.drawer_item, 0, items);
donation_list.setAdapter(adapter);
}
else
{
for(DrawerItem item:items)
{
item.setType(DrawerItemType.STATE_NORMAL);
item.setSelected(false);
}
del_item.setVisible(false);
DrawerAdapter adapter = new DrawerAdapter(context,R.layout.drawer_item, 0, items);
donation_list.setAdapter(adapter);
}
}
};
donation_list.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id) {
if(!isOnSelection)
{
listener.selectionModeChange(v);
}
else
{
selectView(v);
}
return true;
}
});
donation_list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int arg2, long id) {
selectView(v);
}
});
updateDonationList();
getActionBar().setTitle(R.string.donations);
}
@Override
public void onStart() {
super.onStart();
GoogleAnalytics.getInstance(this).reportActivityStart(this);
}
@Override
public void onStop() {
super.onStop();
GoogleAnalytics.getInstance(this).reportActivityStop(this);
}
private void selectView(View v)
{
if(isOnSelection)
{
TextView view = (TextView) v.findViewById(R.id.pos);
long donationId = Integer.valueOf((String) view.getText());
for(DrawerItem item:items)
{
item.setType(DrawerItemType.STATE_CHECK);
if(item.getPos() == donationId)
{
item.setSelected(!item.isSelected());
}
}
DrawerAdapter adapter = new DrawerAdapter(context,R.layout.drawer_item, 0, items);
donation_list.setAdapter(adapter);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.donnation_menu, menu);
del_item = menu.findItem(R.id.action_del);
del_item.setVisible(false);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add:
addDonation();
return true;
case R.id.action_del:
askRemoveDonation();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
public void onBackPressed(){
if(isOnSelection)
{
listener.selectionModeChange(null);
}
else
{
finish();
}
}
private void addDonation()
{
AddDonationDialog dialog = new AddDonationDialog();
Bundle bundle = new Bundle();
bundle.putInt("siteId", -1);
dialog.setArguments(bundle);
dialog.setListener(new NewDonationListener() {
@Override
public void needUpdate() {
updateDonationList();
}
});
dialog.show(getSupportFragmentManager(), "add donation dialog");
}
private void askRemoveDonation()
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.delete_donation_message)
.setCancelable(false)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
removeSelectedDonation();
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
private void removeSelectedDonation()
{
List<Donation> deletedList = new ArrayList<Donation>();
for(int i = 0; i<items.size(); i++)
{
DrawerItem item = items.get(i);
if(item.isSelected())
{
deletedList.add(donations.get(i));
}
}
Database.getInstance(this).deleteDonation(deletedList);
updateDonationList();
}
private void updateDonationList()
{
donations = Database.getInstance(this).getDonations();
items.clear();
for(Donation don : donations)
{
DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault());
df.setTimeZone(TimeZone.getTimeZone("Europe/Paris"));
String texte = df.format(don.getDate().getTime());
texte += " - ";
texte += don.getCityName();
if(don.getCityName().length() > 0)
texte += " - ";
switch(don.getDonationType())
{
case TOTAL_BLOOD:
texte += getResources().getStringArray(R.array.donation_type)[0];
break;
case PLASMA:
texte += getResources().getStringArray(R.array.donation_type)[1];
break;
case PLATELET:
texte += getResources().getStringArray(R.array.donation_type)[2];
break;
default:
//do nothing
break;
}
DrawerItem item = new DrawerItem(DrawerItemType.STATE_NORMAL, texte, null);
items.add(item);
}
DrawerAdapter adapter = new DrawerAdapter(this,R.layout.drawer_item, 0, items);
donation_list.setAdapter(adapter);