--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item>
+ <rotate
+ android:fromDegrees="45"
+ android:pivotX="-45%"
+ android:pivotY="0%"
+ android:toDegrees="45" >
+ <shape android:shape="rectangle" >
+ <stroke
+ android:width="3dp"
+ android:color="#a0a0a0" />
+
+ <solid android:color="#ffffff" />
+ </shape>
+ </rotate>
+ </item>
+
+</layer-list>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/scrollView1"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@color/background" >
-
- <LinearLayout
- android:id="@+id/ll"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingLeft="6dip"
- android:paddingRight="6dip"
- android:paddingTop="6dip" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
-
- <com.touchmenotapps.carousel.simple.HorizontalCarouselLayout
- android:id="@+id/carousel_layout"
- android:layout_width="100dp"
- android:layout_height="50dp" />
-
- <EditText
- android:id="@+id/titre"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="12dip"
- android:gravity="center"
- android:hint="@string/project_name"
- android:inputType="text"
- android:singleLine="true"
- android:textSize="30sp"
- android:textStyle="bold" />
- </LinearLayout>
-
- <ImageView
- android:layout_width="40dp"
- android:layout_height="20dp"
- android:layout_marginLeft="25dp"
- android:layout_marginTop="-25dp"
- android:background="@drawable/bubble"
- android:contentDescription="@string/description_image_project" />
- </LinearLayout>
-
- <EditText
- android:id="@+id/description"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:background="@drawable/buttonshapes"
- android:gravity="center_vertical"
- android:hint="@string/project_description"
- android:inputType="textMultiLine"
- android:padding="3dip"
- android:textSize="20sp" />
-
- <TableLayout
- android:id="@+id/tableLayout1"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_margin="5dip" >
-
- <TableRow
- android:id="@+id/tableRow1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="1dip" >
-
- <TextView
- android:id="@+id/sommeFund"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textSize="15sp"
- android:text="0€"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/sommeRequestFund"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textSize="15sp"
- android:text="0€"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/pourcentage_accomplit"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textSize="15sp"
- android:text="0%"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/nombre_jour_restant_detail"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="0 jour"
- android:textSize="15sp"
- android:textStyle="bold" />
- </TableRow>
-
- <TableRow
- android:id="@+id/tableRow2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="1dip" >
-
- <TextView
- android:id="@+id/recolter"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/funded"
- android:textSize="15sp" />
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/ask"
- android:textSize="15sp" />
-
- <TextView
- android:id="@+id/participants"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/accomplish"
- android:textSize="15sp" />
-
- <TextView
- android:id="@+id/restant"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/remain"
- android:textSize="15sp" />
- </TableRow>
- </TableLayout>
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="3dip"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/mailIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@android:drawable/ic_menu_send" />
-
- <EditText
- android:id="@+id/mail"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/mailIcon"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/email"
- android:inputType="textEmailAddress"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="3dip"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/websiteIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@drawable/ic_menu_attachment" />
-
- <EditText
- android:id="@+id/website"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/websiteIcon"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/site_web"
- android:inputType="textWebEditText"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/phoneIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@android:drawable/ic_menu_call" />
-
- <EditText
- android:id="@+id/phone"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/phoneIcon"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/telephone"
- android:inputType="phone"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <LinearLayout
- android:id="@+id/llinear"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_marginTop="6dip"
- android:orientation="horizontal" >
-
- <ImageView
- android:layout_width="60dp"
- android:layout_height="60dp"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:height="152dp"
- android:id="@+id/avatar"
- android:scaleType="fitXY"
- android:src="@drawable/male_user_icon" />
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes" >
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="6dip" >
-
- <TextView
- android:id="@+id/utilisateur_soumission"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="XXX"
- android:textSize="20sp"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/ville"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingBottom="5dip"
- android:text="XXX"
- android:textSize="15sp" />
- </LinearLayout>
-
- </RelativeLayout>
- </LinearLayout>
-
- <EditText
- android:id="@+id/edit_text_somme"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="5dip"
- android:background="@drawable/buttonshapes"
- android:ems="10"
- android:hint="Somme à récolter"
- android:inputType="number"
- android:padding="5dp"
- android:textSize="20sp" >
- </EditText>
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <TextView
- android:id="@+id/textView4"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/project_end_date"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <DatePicker
- android:id="@+id/date_de_fin"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center" />
- </LinearLayout>
-
- <Button
- android:layout_marginTop="6dip"
- android:id="@+id/button_localisation"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes"
- android:drawableLeft="@android:drawable/ic_menu_mylocation"
- android:text="Ajouter la localisation" />
- </LinearLayout>
-
-</ScrollView>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/background"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <LinearLayout
- android:id="@+id/loading"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <ProgressBar
- android:id="@+id/progressBar1"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/loading" />
-
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/loadingLoadingInfo"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <ProgressBar
- android:id="@+id/progressBar1LoadingInfo"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/textView1LoadingInfo"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textColor="#45C63B"
- android:textSize="35sp"
- android:text="@string/success" />
-
- <TextView
- android:id="@+id/textView1LoadingInfoSub"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textColor="#179CD5"
- android:textSize="25sp"
- android:text="@string/retrievePersonnelInfo" />
-
- </LinearLayout>
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="fill_parent"
- android:layout_height="100dp"
- android:contentDescription="@string/image_cadenas"
- android:gravity="center"
- android:padding="10dp"
- android:src="@drawable/key" />
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/loginIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@android:drawable/ic_menu_myplaces" />
-
- <EditText
- android:id="@+id/login_connexion"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/loginIcon"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/login"
- android:inputType="text"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/passwordIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@drawable/ic_menu_login" />
-
- <EditText
- android:id="@+id/password_connexion"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/passwordIcon"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/password"
- android:inputType="textPassword"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <Button
- android:id="@+id/valider_connexion"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
- android:background="@drawable/buttonshapes"
- android:gravity="center"
- android:text="@string/connexion" />
-
- <Button
- android:id="@+id/inscription_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
- android:background="@drawable/buttonshapes"
- android:gravity="center"
- android:text="@string/creer_un_compte" />
- </LinearLayout>
- </ScrollView>
-
-</LinearLayout>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/background"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <LinearLayout
- android:id="@+id/loading"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <ProgressBar
- android:id="@+id/progressBar1"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/loading" />
- </LinearLayout>
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="fill_parent"
- android:layout_height="100dp"
- android:contentDescription="@string/image_cadenas"
- android:gravity="center"
- android:padding="10dp"
- android:src="@drawable/key" />
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/loginIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@android:drawable/ic_menu_myplaces" />
-
- <EditText
- android:id="@+id/inscription_login"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/loginIcon"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/login"
- android:inputType="text"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/passwordIcon1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@drawable/ic_menu_login" />
-
- <EditText
- android:id="@+id/inscription_password1"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/passwordIcon1"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/password"
- android:inputType="textPassword"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <ImageView
- android:id="@+id/passwordIcon2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:src="@drawable/ic_menu_login" />
-
- <EditText
- android:id="@+id/inscription_password2"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_toRightOf="@+id/passwordIcon2"
- android:ems="10"
- android:gravity="left|center_vertical"
- android:hint="@string/confirmation_mdp"
- android:inputType="textPassword"
- android:textColor="#808080"
- android:textSize="20sp" >
- </EditText>
- </RelativeLayout>
-
- <Button
- android:id="@+id/inscription_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
- android:background="@drawable/buttonshapes"
- android:gravity="center"
- android:text="@string/go_inscription" />
- </LinearLayout>
- </ScrollView>
-
-</LinearLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="10dp"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="10dp" >
+ android:orientation="vertical" >
<LinearLayout
- android:id="@+id/llinear"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
-
- <ImageView
- android:id="@+id/avatar"
- android:layout_width="60dp"
- android:layout_height="60dp"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:height="152dp"
- android:scaleType="fitXY"
- android:src="@drawable/male_user_icon" />
-
- <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginBottom="5dp"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="5dp"
+ android:background="@drawable/buttonshapes"
+ android:orientation="vertical"
+ android:padding="10dp" >
+
+ <LinearLayout
+ android:id="@+id/llinear"
android:layout_width="fill_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+
+ <ImageView
+ android:id="@+id/avatar"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_marginRight="6dip"
+ android:contentDescription="@string/description_image_project"
+ android:height="152dp"
+ android:scaleType="fitXY"
+ android:src="@drawable/male_user_icon" />
+
+ <RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" >
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="6dip" >
+
+ <TextView
+ android:id="@+id/utilisateur_name"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@android:color/black"
+ android:textSize="15sp"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/utilisateur_ville"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingBottom="5dip"
+ android:textColor="@android:color/black"
+ android:textSize="15sp" />
+ </LinearLayout>
+
+ <ImageView
+ android:id="@+id/launchprofile"
+ android:layout_width="20dp"
+ android:layout_height="40dp"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:background="@drawable/arrow"
+ android:contentDescription="@string/description_image_project"
+ android:gravity="right" />
+ </RelativeLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:padding="6dip" >
+
+ <ImageView
+ android:layout_width="40dp"
+ android:layout_height="20dp"
+ android:layout_marginTop="-10dp"
+ android:background="@drawable/bubble"
+ android:contentDescription="@string/description_image_project" />
+
+ <adullact.publicrowdfunding.views.SimpleLine
+ android:layout_width="wrap_content"
+ android:layout_height="3dp"
+ android:layout_marginTop="5dp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="3dip"
+ android:orientation="vertical"
+ android:padding="6dip" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="6dip" >
+ android:orientation="horizontal" >
<TextView
- android:id="@+id/utilisateur_name"
- android:layout_width="fill_parent"
+ android:id="@+id/titre"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textColor="@android:color/black"
+ android:layout_gravity="center"
+ android:paddingLeft="10dip"
+ android:textColor="@android:color/primary_text_light"
android:textSize="15sp"
android:textStyle="bold" />
- <TextView
- android:id="@+id/utilisateur_ville"
- android:layout_width="fill_parent"
+ <RatingBar
+ android:id="@+id/rating"
+ style="@style/smallRatingBar"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingBottom="5dip"
- android:textColor="@android:color/black"
- android:textSize="15sp" />
+ android:layout_marginLeft="-15dip"
+ android:numStars="5"
+ android:scaleX="0.6"
+ android:scaleY="0.6"
+ android:stepSize="1.0" >
+ </RatingBar>
</LinearLayout>
- <ImageView
- android:id="@+id/launchprofile"
- android:layout_width="20dp"
- android:layout_height="40dp"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:background="@drawable/arrow"
- android:contentDescription="@string/description_image_project"
- android:gravity="right" />
- </RelativeLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:padding="6dip" >
-
- <ImageView
- android:layout_width="40dp"
- android:layout_height="20dp"
- android:layout_marginTop="-10dp"
- android:background="@drawable/bubble"
- android:contentDescription="@string/description_image_project" />
-
- <adullact.publicrowdfunding.views.SimpleLine
- android:layout_width="wrap_content"
- android:layout_height="3dp"
- android:layout_marginTop="5dp" />
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="3dip"
- android:orientation="vertical"
- android:padding="6dip" >
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
-
<TextView
- android:id="@+id/titre"
- android:layout_width="wrap_content"
+ android:id="@+id/comment"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="10dip"
android:textColor="@android:color/primary_text_light"
- android:textSize="15sp"
- android:textStyle="bold" />
-
- <RatingBar
- android:id="@+id/rating"
- style="@style/smallRatingBar"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="-15dip"
- android:numStars="5"
- android:scaleX="0.6"
- android:scaleY="0.6"
- android:stepSize="1.0" >
- </RatingBar>
+ android:textSize="15sp" />
</LinearLayout>
-
- <TextView
- android:id="@+id/comment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:paddingLeft="10dip"
- android:textColor="@android:color/primary_text_light"
- android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"
+ android:background="@color/bluebar"
+ android:gravity="center"
+ android:orientation="horizontal"
+ android:padding="10dp"
+ android:weightSum="7" >
+
+ <TextView
+ android:id="@+id/etape1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Detail"
+ android:textSize="15sp" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:contentDescription="@string/description_image_project"
+ android:gravity="center"
+ android:src="@android:drawable/ic_menu_send" />
+
+ <TextView
+ android:id="@+id/etape2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Image"
+ android:textSize="15sp" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:contentDescription="@string/description_image_project"
+ android:gravity="center"
+ android:src="@android:drawable/ic_menu_send" />
+
+ <TextView
+ android:id="@+id/etape3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Position"
+ android:textSize="15sp" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:contentDescription="@string/description_image_project"
+ android:gravity="center"
+ android:src="@android:drawable/ic_menu_send" />
+
+ <TextView
+ android:id="@+id/etape4"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Valider"
+ android:textSize="15sp" />
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/background"
+ android:orientation="vertical" >
+
+ <adullact.publicrowdfunding.controller.project.add.BreadCrumbView
+ android:id="@+id/breadcrumb"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/background" >
+
+ <adullact.publicrowdfunding.controller.project.add.BreadCrumbView
+ android:id="@+id/breadcrumb"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <fragment
+ android:layout_marginTop="50dp"
+ android:id="@+id/map"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ class="com.google.android.gms.maps.SupportMapFragment" />
+
+ <Button
+ android:layout_margin="10dp"
+ android:layout_gravity="bottom"
+ android:background="@drawable/buttonshapes"
+ android:id="@+id/button_valider"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Etape suivante" />
+
+</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical" >
- <LinearLayout
- android:id="@+id/loading"
+ <adullact.publicrowdfunding.controller.project.add.BreadCrumbView
+ android:id="@+id/breadcrumb"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <ProgressBar
- android:id="@+id/progressBar1"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/loading" />
- </LinearLayout>
+ android:layout_height="wrap_content" />
<ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:id="@+id/showLoaded"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="50dp"
+ android:orientation="vertical" >
<LinearLayout
- android:id="@+id/ll"
- android:layout_width="fill_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="5dp" >
+ android:orientation="vertical" >
- <LinearLayout
+ <FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingLeft="6dip"
- android:paddingRight="6dip"
- android:paddingTop="6dip" >
+ android:orientation="vertical" >
<LinearLayout
+ android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal" >
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:orientation="vertical"
+ android:paddingLeft="1dp"
+ android:paddingRight="1dp" >
- <com.touchmenotapps.carousel.simple.HorizontalCarouselLayout
- android:id="@+id/carousel_layout"
- android:layout_width="100dp"
- android:layout_height="50dp" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="30dp"
+ android:background="@drawable/buttonshapes"
+ android:orientation="vertical"
+ android:paddingBottom="10dp"
+ android:paddingTop="40dp" >
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="10dp"
+ android:contentDescription="@string/description_image_project"
+ android:src="@drawable/ribbon_shadow" />
+
+ <EditText
+ android:id="@+id/description"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dip"
+ android:gravity="top"
+ android:hint="@string/project_description"
+ android:inputType="textMultiLine"
+ android:minHeight="100dp"
+ android:padding="3dip"
+ android:textSize="20sp" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <FrameLayout
+ android:id="@+id/frame"
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="10dp"
+ android:layout_marginTop="40dp" >
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="40dp"
+ android:layout_marginRight="10dp"
+ android:contentDescription="@string/description_image_project"
+ android:src="@drawable/rectangle" />
+
+ <ImageView
+ android:layout_width="10dp"
+ android:layout_height="10dp"
+ android:layout_marginTop="40dp"
+ android:contentDescription="@string/description_image_project"
+ android:src="@drawable/ribbon" />
<EditText
android:id="@+id/titre"
android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="12dip"
+ android:layout_height="40dp"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
android:gravity="center"
android:hint="@string/project_name"
android:inputType="text"
android:singleLine="true"
- android:textSize="30sp"
+ android:textColor="#ffffff"
+ android:textColorHint="#ffffff"
+ android:textSize="20sp"
android:textStyle="bold" />
- </LinearLayout>
-
- <ImageView
- android:layout_width="40dp"
- android:layout_height="20dp"
- android:layout_marginLeft="25dp"
- android:layout_marginTop="-25dp"
- android:background="@drawable/bubble"
- android:contentDescription="@string/description_image_project" />
- </LinearLayout>
+ </FrameLayout>
+ </FrameLayout>
- <EditText
- android:id="@+id/description"
+ <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
android:background="@drawable/buttonshapes"
- android:gravity="center_vertical"
- android:hint="@string/project_description"
- android:inputType="textMultiLine"
- android:padding="3dip"
- android:textSize="20sp" />
-
- <TableLayout
- android:id="@+id/tableLayout1"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_margin="5dip" >
+ android:orientation="vertical" >
- <TableRow
- android:id="@+id/tableRow1"
- android:layout_width="wrap_content"
+ <EditText
+ android:id="@+id/edit_text_somme"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:padding="1dip" >
+ android:ems="10"
+ android:hint="Somme à récolter"
+ android:inputType="number"
+ android:textSize="20sp" >
+ </EditText>
+ </LinearLayout>
- <TextView
- android:id="@+id/sommeFund"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="0€"
- android:textSize="15sp"
- android:textStyle="bold" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
+ android:background="@drawable/buttonshapes"
+ android:orientation="vertical"
+ android:padding="5dp" >
- <TextView
- android:id="@+id/sommeRequestFund"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="0€"
- android:textSize="15sp"
- android:textStyle="bold" />
+ <TextView
+ android:id="@+id/textView4"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="@string/project_end_date"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
- <TextView
- android:id="@+id/pourcentage_accomplit"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="0%"
- android:textSize="15sp"
- android:textStyle="bold" />
+ <DatePicker
+ android:id="@+id/date_de_fin"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center" />
+ </LinearLayout>
- <TextView
- android:id="@+id/nombre_jour_restant_detail"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="0 jour"
- android:textSize="15sp"
- android:textStyle="bold" />
- </TableRow>
+ <LinearLayout
+ android:id="@+id/llinear"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
+ android:orientation="horizontal" >
- <TableRow
- android:id="@+id/tableRow2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="1dip" >
+ <ImageView
+ android:id="@+id/avatar"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_marginRight="6dip"
+ android:contentDescription="@string/description_image_project"
+ android:height="152dp"
+ android:scaleType="fitXY"
+ android:src="@drawable/male_user_icon" />
- <TextView
- android:id="@+id/recolter"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/funded"
- android:textSize="15sp" />
+ <RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/buttonshapes" >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/ask"
- android:textSize="15sp" />
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="10dp"
+ android:orientation="vertical" >
- <TextView
- android:id="@+id/participants"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/accomplish"
- android:textSize="15sp" />
+ <TextView
+ android:id="@+id/utilisateur_soumission"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="XXX"
+ android:textSize="20sp"
+ android:textStyle="bold" />
- <TextView
- android:id="@+id/restant"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/remain"
- android:textSize="15sp" />
- </TableRow>
- </TableLayout>
+ <TextView
+ android:id="@+id/ville"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="XXX"
+ android:textSize="15sp" />
+ </LinearLayout>
+ </RelativeLayout>
+ </LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="3dip"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
+ android:orientation="vertical" >
<ImageView
android:id="@+id/mailIcon"
android:id="@+id/mail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
android:layout_toRightOf="@+id/mailIcon"
android:ems="10"
android:gravity="left|center_vertical"
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="3dip"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
+ android:orientation="vertical" >
<ImageView
android:id="@+id/websiteIcon"
android:id="@+id/website"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
android:layout_toRightOf="@+id/websiteIcon"
android:ems="10"
android:gravity="left|center_vertical"
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
+ android:orientation="vertical" >
<ImageView
android:id="@+id/phoneIcon"
android:id="@+id/phone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
android:layout_toRightOf="@+id/phoneIcon"
android:ems="10"
android:gravity="left|center_vertical"
</EditText>
</RelativeLayout>
- <LinearLayout
- android:id="@+id/llinear"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_marginTop="6dip"
- android:orientation="horizontal" >
-
- <ImageView
- android:id="@+id/avatar"
- android:layout_width="60dp"
- android:layout_height="60dp"
- android:layout_marginRight="6dip"
- android:contentDescription="@string/description_image_project"
- android:height="152dp"
- android:scaleType="fitXY"
- android:src="@drawable/male_user_icon" />
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes" >
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="6dip" >
-
- <TextView
- android:id="@+id/utilisateur_soumission"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="XXX"
- android:textSize="20sp"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/ville"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingBottom="5dip"
- android:text="XXX"
- android:textSize="15sp" />
- </LinearLayout>
- </RelativeLayout>
- </LinearLayout>
-
- <EditText
- android:id="@+id/edit_text_somme"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="5dip"
- android:background="@drawable/buttonshapes"
- android:ems="10"
- android:hint="Somme à récolter"
- android:inputType="number"
- android:padding="5dp"
- android:textSize="20sp" >
- </EditText>
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/buttonshapes"
- android:orientation="vertical"
- android:padding="5dp" >
-
- <TextView
- android:id="@+id/textView4"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/project_end_date"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <DatePicker
- android:id="@+id/date_de_fin"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center" />
- </LinearLayout>
-
- <FrameLayout
- android:id="@+id/mapView"
- android:layout_width="match_parent"
- android:layout_height="300dp" >
- </FrameLayout>
-
<Button
android:id="@+id/button_valider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="6dip"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dip"
android:background="@drawable/buttonshapes"
- android:drawableLeft="@android:drawable/ic_menu_mylocation"
- android:text="Soumettre le projet" />
+ android:text="Etape suivante" />
</LinearLayout>
</ScrollView>
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/background"
+ android:orientation="vertical" >
+
+ <adullact.publicrowdfunding.controller.project.add.BreadCrumbView
+ android:id="@+id/breadcrumb"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <LinearLayout
+ android:id="@+id/llinear"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="10dp"
+ android:gravity="center"
+ android:orientation="horizontal" >
+
+ <ImageView
+ android:id="@+id/checkbox"
+ android:layout_width="100dp"
+ android:layout_height="100dp"
+ android:layout_marginRight="6dip"
+ android:contentDescription="@string/description_image_project"
+ android:scaleType="fitXY"
+ android:src="@drawable/checkbox_unchecked" />
+
+ <TextView
+ android:id="@+id/message"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_weight="1"
+ android:text="Chargement"
+ android:textSize="30sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
android:contentDescription="@string/description_image_project"
android:src="@drawable/ribbon_shadow" />
- <TextView
- android:id="@+id/detail_projet_detail"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:drawableStart="@drawable/ic_launcher"
- android:text="@string/project_description"
- android:textSize="15sp" />
+ android:orientation="horizontal"
+ android:padding="10dp" >
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="100dp"
+ android:layout_height="100dp"
+ android:layout_marginRight="6dip"
+ android:contentDescription="@string/description_image_project"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_launcher" />
+
+ <TextView
+ android:id="@+id/detail_projet_detail"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/project_description"
+ android:textSize="15sp" />
+ </LinearLayout>
<adullact.publicrowdfunding.views.SimpleLine
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
- android:layout_marginBottom="0dp"
+ android:layout_marginLeft="7dp"
+ android:layout_marginRight="2dp"
android:padding="10dip" >
<Button
android:id="@+id/payer"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/buttonshapes"
- android:gravity="center"
android:text="@string/contribute" />
</FrameLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refresher"
- android:layout_marginBottom="50dp"
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="60dp" >
<ListView
android:id="@+id/commentaires"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
- android:layout_marginBottom="0dp"
android:padding="10dip" >
<Button
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/map_frag"
- android:name="com.google.android.gms.maps.SupportMapFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true"/>
+++ /dev/null
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- >
-
- <item
- android:id="@+id/menu_settings"
- android:orderInCategory="100"
- android:title="Action Bar1"/>
-
-</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item
- android:id="@+id/Share"
- android:icon="@android:drawable/ic_menu_share"
- android:showAsAction="ifRoom"
- android:title="partager"/>
<item
android:id="@+id/add_favorite"
android:icon="@drawable/ic_menu_star"
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/preferences"
- android:icon="@android:drawable/ic_menu_preferences"
- android:showAsAction="ifRoom"
- android:title="Preferences"/>
-
-</menu>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/soumettre"
- android:icon="@android:drawable/ic_menu_send"
- android:showAsAction="always"
- android:title="@string/valider"/>
-
-</menu>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- the theme applied to the application or activity -->
- <style name="CustomActionBarTheme"
- parent="@style/Theme.AppCompat">
- <item name="android:actionBarTabStyle">@style/MyActionBarTabs</item>
-
- <!-- Support library compatibility -->
- <item name="actionBarTabStyle">@style/MyActionBarTabs</item>
- </style>
-
- <!-- ActionBar tabs styles -->
- <style name="MyActionBarTabs"
- parent="@style/Widget.AppCompat.ActionBar.TabView">
- <!-- tab indicator -->
- <item name="android:background">@color/white</item>
-
- <!-- Support library compatibility -->
- <item name="background">@color/white</item>
- </style>
-
-</resources>
\ No newline at end of file
<string name="zero">0</string>
<string name="no_days"> 0 jour</string>
<string name="participants">participants</string>
- <string name="remain">restant</string>
- <string name="funded">récoltés</string>
+ <string name="remain">Restant</string>
+ <string name="funded">Récoltés</string>
<string name="site_web">Site internet</string>
<string name="telephone">Numéro de téléphone</string>
<string name="confirmation_mdp">Confirmation du mot de passe</string>
<string name="change_your_email">Modifier votre Email</string>
<string name="financed">Financé</string>
<string name="register">S\'inscrire</string>
- <string name="days">%s days</string>
+ <string name="days">%s jours</string>
<string name="currency">%s €</string>
</resources>
\ No newline at end of file
<color name="yellow">#ffff00</color>
<color name="blue2">#a06990ee</color>
<color name="orange">#ffb95a</color>
+ <color name="bluebar">#a1b9f5</color>
+
<!-- color name="background">#0d0d0d0</color -->
+++ /dev/null
-package adullact.publicrowdfunding;
-
-import adullact.publicrowdfunding.custom.ProjectAdaptor;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.LinearLayout;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class ListProjectsFragment extends Fragment {
-
- private ListView listeProjets;
-
- private SwipeRefreshLayout swipeView;
-
- private ArrayAdapter<Project> adapter;
-
- private adullact.publicrowdfunding.MainActivity _this;
-
- private LinearLayout loading;
-
- private Fragment fragment;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- final View view = inflater.inflate(R.layout.fragment_liste_projet,
- container, false);
-
- fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.ProjectPagerFragment();
- _this = (adullact.publicrowdfunding.MainActivity) getActivity();
-
- listeProjets = (ListView) view.findViewById(R.id.liste);
-
- loading = (LinearLayout) view.findViewById(R.id.loading);
-
- adapter = new ProjectAdaptor(this.getActivity().getBaseContext(),
- R.layout.adaptor_project, _this.p_project_displayed);
-
- TextView empty = (TextView) view.findViewById(R.id.empty);
- listeProjets.setEmptyView(empty);
-
- listeProjets.setAdapter(adapter);
- swipeView = (SwipeRefreshLayout) view.findViewById(R.id.refresher);
- swipeView.setEnabled(false);
-
- swipeView.setColorScheme(R.color.blue, R.color.green, R.color.yellow,
- R.color.red);
- swipeView
- .setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- swipeView.setRefreshing(true);
- refresh();
-
- }
-
- });
-
- listeProjets.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.setCustomAnimations(R.anim.fade_enter, R.anim.fade_exit);
- Bundle bundle = new Bundle();
- bundle.putString("idProject", _this.p_project_displayed.get(position).getResourceId());
- fragment.setArguments(bundle);
- ft.addToBackStack(null);
- fragment.setHasOptionsMenu(true);
- ft.replace(R.id.content_frame, fragment);
- ft.commit();
-
- }
- });
-
- listeProjets.setOnScrollListener(new AbsListView.OnScrollListener() {
- @Override
- public void onScrollStateChanged(AbsListView absListView, int i) {
-
- }
-
- @Override
- public void onScroll(AbsListView absListView, int firstVisibleItem,
- int visibleItemCount, int totalItemCount) {
- if (firstVisibleItem == 0)
- swipeView.setEnabled(true);
- else
- swipeView.setEnabled(false);
- }
- });
- loading.setVisibility(View.GONE);
- return view;
-
- }
-
- public void refresh() {
- _this.syncProjects();
-
- }
-
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-
- try{
- menu.clear();
- }catch(Exception e){
- e.printStackTrace();
- }
- inflater.inflate(R.menu.menu_main, menu);
- super.onCreateOptionsMenu(menu, inflater);
- }
-
-
- @Override
- public void onPrepareOptionsMenu(Menu menu) {
-
- }
-
-}
\ No newline at end of file
package adullact.publicrowdfunding;
-import java.util.List;
-
-import adullact.publicrowdfunding.controller.profile.preferences.preferencesFragment;
-import adullact.publicrowdfunding.controller.project.all.ListProjectsFragment;
-import adullact.publicrowdfunding.controller.project.all.MapFragment;
-import adullact.publicrowdfunding.controller.project.details.ProjectPagerFragment;
-import adullact.publicrowdfunding.controller.register.ConnexionFragment;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Funding;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.Resource;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
-import adullact.publicrowdfunding.views.SimpleLine;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.maps.model.LatLng;
+import java.util.List;
+
+import adullact.publicrowdfunding.controller.profile.preferences.preferencesFragment;
+import adullact.publicrowdfunding.controller.project.add.addProjectFragment;
+import adullact.publicrowdfunding.controller.project.all.ListProjectsFragment;
+import adullact.publicrowdfunding.controller.project.all.MapFragment;
+import adullact.publicrowdfunding.controller.project.details.ProjectPagerFragment;
+import adullact.publicrowdfunding.controller.register.ConnexionFragment;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.Funding;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+import adullact.publicrowdfunding.model.server.event.CreateEvent;
+import adullact.publicrowdfunding.views.SimpleLine;
+
/**
* @author Ferrand and Nelaupe
*/
.beginTransaction();
// ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new adullact.publicrowdfunding.controller.project.add.addProjectFragment();
+ Fragment fragment = new addProjectFragment();
ft.addToBackStack(null);
ft.replace(R.id.content_frame, fragment);
+ ft.replace(R.id.content_frame, fragment);
ft.commit();
closeDrawer();
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
+ Toast.makeText(
+ getBaseContext(),
+ "Patientez ...",
+ Toast.LENGTH_SHORT)
+ .show();
// Payement ok !
final String idProject = data.getStringExtra("idProject");
final String somme = data.getStringExtra("somme");
}
- });
+ @Override
+ public void errorAdministratorRequired() {
+ // TODO Auto-generated
+ // method stub
+ }
+ });
} catch (NoAccountExistsInLocal e) {
// TODO Auto-generated catch block
e.printStackTrace();
+++ /dev/null
-package adullact.publicrowdfunding;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
-import android.app.ProgressDialog;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.google.android.gms.maps.CameraUpdate;
-import com.google.android.gms.maps.CameraUpdateFactory;
-import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener;
-import com.google.android.gms.maps.SupportMapFragment;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.Marker;
-import com.google.android.gms.maps.model.MarkerOptions;
-
-public class MapFragment extends Fragment implements
- OnInfoWindowClickListener {
-
- private SupportMapFragment fragment;
- private FragmentManager fm;
- private ProgressDialog mprogressDialog;
- private View rootView;
- private GoogleMap googleMap;
- private final HashMap<Marker, Project> markers = new HashMap<Marker, Project>();
-
- private View infoWindow;
-
- private ArrayList<Project> projets;
-
- private MapFragment _this;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- rootView = inflater.inflate(R.layout.activity_maps, container, false);
-
-
- infoWindow = getLayoutInflater(null).inflate(
- R.layout.fiche_project, null);
- projets = new ArrayList<Project>();
-
- _this = this;
-
- mprogressDialog = new ProgressDialog(getActivity());
- mprogressDialog.setMessage("Chargement en cours...");
- mprogressDialog.setTitle("Google Map");
- mprogressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
- mprogressDialog.show();
-
- fragment = new SupportMapFragment();
- fm = getFragmentManager();
-
- SyncServerToLocal sync = SyncServerToLocal.getInstance();
- Account.getOwnOrAnonymous().setLastSync(null);
- sync.sync(new HoldAllToDo<Project>() {
-
- @Override
- public void holdAll(ArrayList<Project> projects) {
- projets = projects;
- initMaps();
- }
- });
-
- return rootView;
- }
-
- @Override
- public void onInfoWindowClick(Marker marker) {
-
-
- String id = markers.get(marker).getResourceId();
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- // ft.setCustomAnimations(R.anim.enter_2, R.anim.exit); Fragment
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.ProjectPagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", id);
- fragment.setArguments(bundle);
- ft.replace(R.id.content_frame, fragment);
- ft.commit();
-
- }
-
- public void initMaps(){
-
- FragmentTransaction ft = fm.beginTransaction();
- ft.replace(R.id.mapView, fragment, "mapid").commit();
-
- final Handler handler = new Handler();
- handler.postDelayed(new Runnable() {
-
- @Override
- public void run() {
-
- googleMap = ((SupportMapFragment) fm.findFragmentByTag("mapid"))
- .getMap();
-
- if (googleMap != null) {
- for (Project proj : projets) {
- MarkerOptions marker = new MarkerOptions();
- marker.position(proj.getPosition());
- marker.title(proj.getName());
- Marker m = googleMap.addMarker(marker);
-
- markers.put(m, proj);
- }
-
- googleMap.setOnInfoWindowClickListener(_this);
- googleMap
- .setInfoWindowAdapter(new adullact.publicrowdfunding.custom.MarkerWindowAdaptor(
- getLayoutInflater(null), markers));
-
- handler.removeCallbacksAndMessages(null);
-
- // googleMap.setOnMarkerClickListener(TabMapFragment.this);
- googleMap.setMyLocationEnabled(true);
- LatLng Montpellier = new LatLng(43.652400, 3.761380);
- CameraUpdate center = CameraUpdateFactory
- .newLatLng(Montpellier);
- CameraUpdate zoom = CameraUpdateFactory.zoomTo(9);
- googleMap.moveCamera(center);
- googleMap.animateCamera(zoom);
- mprogressDialog.dismiss();
- }
-
- else {
- handler.postDelayed(this, 2000);
- }
- }
- }, 2000);
- }
-
-
-}
package adullact.publicrowdfunding;
-import adullact.publicrowdfunding.model.local.ressource.Account;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+
/**
* @author Ferrand and Nelaupe
*/
+++ /dev/null
-package adullact.publicrowdfunding.controller.adaptor;
-
-import java.util.ArrayList;
-
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-
-/**
- * @author Ferrand and Nelaupe
- */
-public class CarouselAdaptor extends BaseAdapter {
-
- private ArrayList<Integer> mData = new ArrayList<Integer>(0);
- private Context mContext;
-
- public CarouselAdaptor(Context context) {
- mContext = context;
- }
-
- public void setData(ArrayList<Integer> data) {
- mData = data;
- }
-
- @Override
- public int getCount() {
- return mData.size();
- }
-
- @Override
- public Object getItem(int pos) {
- return mData.get(pos);
- }
-
- @Override
- public long getItemId(int pos) {
- return pos;
- }
-
- @Override
- public View getView(int arg0, View arg1, ViewGroup arg2) {
- ImageView mImage= new ImageView(mContext);
- mImage.setImageResource(mData.get(arg0));
- mImage.setScaleX((float) 1.7);
- mImage.setScaleY((float) 1.7);
- return mImage;
- }
-
-}
package adullact.publicrowdfunding.controller.adaptor;
-import java.util.Vector;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Commentary;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Share;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.widget.RatingBar;
import android.widget.TextView;
+import java.util.Vector;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Commentary;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+
/**
*
* @author warting {@link https://github.com/warting/AndroidChatBubbles}
package adullact.publicrowdfunding.controller.adaptor;
-import java.util.HashMap;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.Calcul;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import adullact.publicrowdfunding.views.CustomProgressBar;
+import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
import com.google.android.gms.maps.model.Marker;
+import java.util.HashMap;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.utilities.Calcul;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+import adullact.publicrowdfunding.model.local.utilities.Utility;
+import adullact.publicrowdfunding.views.CustomProgressBar;
+
/**
* @author Ferrand and Nelaupe
*/
private TextView sommeFunded;
private TextView sommeDemander;
private TextView distance;
+ private Context context;
private final HashMap<Marker, Project> markers;
private LayoutInflater inflater;
- public MarkerWindowAdaptor(LayoutInflater inflater, HashMap<Marker, Project> markers) {
+ public MarkerWindowAdaptor(Context context, LayoutInflater inflater, HashMap<Marker, Project> markers) {
this.inflater=inflater;
this.markers = markers;
+ this.context = context;
}
public void displayInfo(Project projet) {
titre_projet_liste.setText(projet.getName());
description_projet_liste.setText(projet.getDescription());
- String days = this.getResources().getString(R.string.days, projet.getNumberOfDayToEnd());
+ String days = context.getResources().getString(R.string.days, projet.getNumberOfDayToEnd());
temps_restant_projet_liste.setText(days);
- String requested = this.getResources().getString(R.string.currency, projet.getRequestedFunding());
+ String requested = context.getResources().getString(R.string.currency, projet.getRequestedFunding());
avancement_projet_liste.setProgress(projet.getPercentOfAchievement());
sommeDemander.setText(requested);
- String currentFunded = this.getResources().getString(R.string.currency, projet.getCurrentFunding());
+ String currentFunded = context.getResources().getString(R.string.currency, projet.getCurrentFunding());
sommeFunded.setText(currentFunded);
if (projet.getIllustration() != 0) {
illustration.setImageResource(Utility.getDrawable(projet
distance.setVisibility(View.GONE);
try {
- distance.setText(R.string.distance
- + Calcul.diplayDistance(Share.position,
+ String texte = context.getResources().getString(R.string.distance);
+ distance.setText(
+ texte + Calcul.diplayDistance(Share.position,
projet.getPosition()));
distance.setVisibility(View.VISIBLE);
} catch (NullPointerException e) {
package adullact.publicrowdfunding.controller.adaptor;
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.Calcul;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import adullact.publicrowdfunding.views.CustomProgressBar;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
+import java.util.ArrayList;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.utilities.Calcul;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+import adullact.publicrowdfunding.model.local.utilities.Utility;
+import adullact.publicrowdfunding.views.CustomProgressBar;
+
/**
* @author Ferrand and Nelaupe
*/
+++ /dev/null
-package adullact.publicrowdfunding.controller.addProject;
-
-import adullact.publicrowdfunding.R;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.widget.Toast;
-
-import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
-import com.google.android.gms.maps.SupportMapFragment;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.Marker;
-import com.google.android.gms.maps.model.MarkerOptions;
-
-public class AddLocationProject extends FragmentActivity implements
- OnMapClickListener {
- private GoogleMap map;
- private Marker marker;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.fragment_maps);
- InitialiseMap();
-
- Intent data = getIntent();
- data.getExtras();
- Bundle extras3 = data.getExtras();
- if (extras3 != null) {
- LatLng position = new LatLng(extras3.getDouble("latitude"),
- extras3.getDouble("longitude"));
- marker = map.addMarker(new MarkerOptions().position(position)
- .title("Votre projet"));
- } else {
- marker = null;
- }
- }
-
- private void InitialiseMap() {
- // TODO Auto-generated method stub
- if (map == null) {
- map = ((SupportMapFragment) getSupportFragmentManager()
- .findFragmentById(R.id.map_frag)).getMap();
-
- if (map != null) {
-
- }
-
- map.setOnMapClickListener(this);
- map.setMyLocationEnabled(true);
-
- }
- }
-
- @Override
- public void onMapClick(LatLng arg0) {
- Toast.makeText(getApplicationContext(),
- "Emplacement de votre projet ajouté", Toast.LENGTH_SHORT)
- .show();
- if (marker == null) {
- marker = map.addMarker(new MarkerOptions().position(arg0).title(
- "Votre projet"));
- } else {
- marker.remove();
- marker = map.addMarker(new MarkerOptions().position(arg0).title(
- "Votre projet"));
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu items for use in the action bar
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.soumission, menu);
- return super.onCreateOptionsMenu(menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- switch (item.getItemId()) {
- case R.id.soumettre:
- Intent returnIntent = new Intent();
- returnIntent.putExtra("latitude", marker.getPosition().latitude);
- returnIntent.putExtra("longitude", marker.getPosition().longitude);
- setResult(RESULT_OK, returnIntent);
- finish();
-
- }
- return false;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.controller.addProject;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.custom.CarouselAdaptor;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
-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.Button;
-import android.widget.DatePicker;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.google.android.gms.maps.model.LatLng;
-import com.touchmenotapps.carousel.simple.HorizontalCarouselLayout;
-import com.touchmenotapps.carousel.simple.HorizontalCarouselLayout.CarouselInterface;
-import com.touchmenotapps.carousel.simple.HorizontalCarouselStyle;
-
-public class MainActivity extends FragmentActivity {
-
- private EditText m_titre;
- private EditText m_Description;
- private EditText m_edit_text_somme;
- private EditText m_email;
- private EditText m_phone;
- private EditText m_website;
-
- private TextView m_user_pseudo;
- private TextView m_user_ville;
-
- private DatePicker m_dateFin;
-
- private Button m_localisation;
-
- private Context context;
-
- private int m_illustration;
-
- private LatLng position;
-
- private User user;
-
- private static final int PICK_MAPS = 3;
-
- private ImageView avatar;
-
- private HorizontalCarouselStyle mStyle;
- private HorizontalCarouselLayout mCarousel;
- private CarouselAdaptor mAdapter;
- private ArrayList<Integer> mData = new ArrayList<Integer>(0);
-
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public void supprimerCalendarView() {
- int currentapiVersion = android.os.Build.VERSION.SDK_INT;
- if (currentapiVersion >= 11) {
- m_dateFin.setCalendarViewShown(false);
- }
-
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_add_project);
-
- m_titre = (EditText) findViewById(R.id.titre);
- m_Description = (EditText) findViewById(R.id.description);
- m_dateFin = (DatePicker) findViewById(R.id.date_de_fin);
- m_localisation = (Button) findViewById(R.id.button_localisation);
- m_edit_text_somme = (EditText) findViewById(R.id.edit_text_somme);
- m_user_pseudo = (TextView) findViewById(R.id.utilisateur_soumission);
- m_user_ville = (TextView) findViewById(R.id.ville);
-
- m_email = (EditText) findViewById(R.id.mail);
- m_website = (EditText) findViewById(R.id.website);
- m_phone = (EditText) findViewById(R.id.phone);
-
- m_edit_text_somme = (EditText) findViewById(R.id.edit_text_somme);
-
- avatar = (ImageView) findViewById(R.id.avatar);
-
- try {
- Account compte = Account.getOwn();
- compte.getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- if (resource == null) {
- finish();
- }
- user = resource;
- System.out.println(user.getResourceId());
-
- m_user_pseudo.setText(resource.getPseudo());
- m_user_ville.setText(resource.getCity());
- if (resource.getGender().equals("0")) {
- avatar.setImageResource(R.drawable.male_user_icon);
- } else {
- avatar.setImageResource(R.drawable.female_user_icon);
- }
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- finish();
- }
-
- m_illustration = 0;
-
- context = this;
-
- position = new LatLng(0, 0);
-
- mData.add(R.drawable.ic_launcher);
- mData.add(R.drawable.roi);
- mData.add(R.drawable.basketball);
- mData.add(R.drawable.plante);
- mData.add(R.drawable.fete);
-
- mAdapter = new CarouselAdaptor(this);
- mAdapter.setData(mData);
- mCarousel = (HorizontalCarouselLayout) findViewById(R.id.carousel_layout);
- mStyle = new HorizontalCarouselStyle(this,
- HorizontalCarouselStyle.NO_STYLE);
- mCarousel.setStyle(mStyle);
- mCarousel.setAdapter(mAdapter);
-
- mCarousel.setOnCarouselViewChangedListener(new CarouselInterface() {
-
- @Override
- public void onItemChangedListener(View v, int position) {
- m_illustration = position;
- }
- });
-
- m_localisation.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent in = new Intent(getBaseContext(),
- AddLocationProject.class);
- if (position != null) {
- in.putExtra("latitude", position.latitude);
- in.putExtra("longitude", position.longitude);
- }
-
- startActivityForResult(in, 3);
- }
- });
-
- supprimerCalendarView();
-
- }
-
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-
- if (resultCode != Activity.RESULT_OK) {
- return;
- }
-
- switch (requestCode) {
-
- case PICK_MAPS:
- Bundle extras3 = data.getExtras();
- if (extras3 != null) {
-
- position = new LatLng(extras3.getDouble("latitude"),
- extras3.getDouble("longitude"));
- Toast.makeText(getApplicationContext(),
- "Position du projet ajouté", Toast.LENGTH_SHORT).show();
- m_localisation.setText("Votre projet est localisé");
- }
- break;
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
-
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.soumission, menu);
- return super.onCreateOptionsMenu(menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- switch (item.getItemId()) {
-
- case R.id.soumettre:
-
- String titre = null;
- if (m_titre.length() == 0) {
- Toast.makeText(context, "Merci de mettre un titre",
- Toast.LENGTH_SHORT).show();
- return false;
- }
- titre = m_titre.getText().toString();
-
- String description = null;
- if (m_Description.length() == 0) {
- Toast.makeText(context, "Merci de mettre une description",
- Toast.LENGTH_SHORT).show();
- return false;
- }
- description = m_Description.getText().toString();
-
- String somme = null;
- if (m_edit_text_somme.length() == 0) {
- Toast.makeText(context, "Merci de mettre la somme désiré",
- Toast.LENGTH_SHORT).show();
- return false;
- }
- somme = m_edit_text_somme.getText().toString();
-
- try {
- int s = Integer.parseInt(somme);
- if (s < 1) {
- Toast.makeText(context, "Le montant est invalide",
- Toast.LENGTH_SHORT).show();
- return false;
- }
-
- } catch (Exception e) {
- Toast.makeText(context, "Le montant est invalide",
- Toast.LENGTH_SHORT).show();
- return false;
- }
-
- int day = m_dateFin.getDayOfMonth();
- int month = m_dateFin.getMonth() + 1;
- int year = m_dateFin.getYear();
- Calendar calendar = Calendar.getInstance();
- calendar.set(year, month, day);
-
- String Stryear = "" + year;
- String StrMonth = null;
- if (month < 10) {
- StrMonth = "0" + month;
- } else {
- StrMonth = "" + month;
- }
-
- String StrDay = "" + day;
-
- new Project(titre, description, user.getResourceId(), somme,
- Utility.stringToDateTime(Stryear + "-" + StrMonth + "-"
- + StrDay + " 00:00:00"),
- Utility.stringToDateTime(Stryear + "-" + StrMonth + "-"
- + StrDay + " 00:00:00"), new LatLng(
- position.latitude, position.longitude),
- m_illustration, m_email.getText().toString(), m_website
- .getText().toString(),
- m_phone.getText().toString(), false)
- .serverCreate(new CreateEvent<Project>() {
- @Override
- public void errorResourceIdAlreadyUsed() {
- System.out.println("id déja utilisé");
- Toast.makeText(getApplicationContext(),
- "Erreur interne du serveur",
- Toast.LENGTH_SHORT).show();
- }
-
- @Override
- public void onCreate(Project resource) {
- System.out.println("Le projet à bien était ajouté");
- Toast.makeText(getApplicationContext(),
- "Le projet à bien était ajouté",
- Toast.LENGTH_SHORT).show();
- finish();
- }
-
- @Override
- public void errorAuthenticationRequired() {
- Toast.makeText(getApplicationContext(),
- "Vous devez vous authentifier",
- Toast.LENGTH_SHORT).show();
- System.out.println("Auth required");
- }
-
- @Override
- public void errorNetwork() {
- Toast.makeText(getApplicationContext(),
- "Probléme avec le réseau",
- Toast.LENGTH_SHORT).show();
- System.out.println("network error");
- }
- });
-
- return true;
-
- }
- return false;
-
- }
-}
+++ /dev/null
-package adullact.publicrowdfunding.controller.preferences;
-
-import adullact.publicrowdfunding.MainActivity;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.server.event.UpdateEvent;
-import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.EditTextPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.SwitchPreference;
-import android.support.v4.preference.PreferenceFragment;
-import android.widget.Toast;
-
-public class preferencesFragment extends PreferenceFragment {
-
- private User user;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- addPreferencesFromResource(R.layout.fragment_preferences);
-
- /*
- * Utilisateur
- */
-
- final EditTextPreference ville = (EditTextPreference) findPreference("edittext_preference_ville");
- final EditTextPreference nom = (EditTextPreference) findPreference("edittext_preference_nom");
- final EditTextPreference prenom = (EditTextPreference) findPreference("edittext_preference_prenom");
- final EditTextPreference email = (EditTextPreference) findPreference("edittext_preference_email");
-
- final SwitchPreference genre = (SwitchPreference) findPreference("genre");
- genre.setSwitchTextOn("Femme");
- genre.setSwitchTextOff("Homme");
-
- /*
- * Compte
- */
-
- CheckBoxPreference isAdmin = (CheckBoxPreference) findPreference("checkbox_admin");
-
- try {
- Account account = Account.getOwn();
- if (account.isAdmin()) {
- isAdmin.setChecked(true);
- }
- account.getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
-
- user = resource;
- resource.getName();
- ville.setText(resource.getCity());
- nom.setText(resource.getName());
- prenom.setText(resource.getFirstName());
- email.setText("");
- if (resource.getGender().equals("1")) {
- genre.setChecked(true);
- } else {
- genre.setChecked(false);
- }
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- getActivity().finish();
- }
-
- ville.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- public boolean onPreferenceChange(Preference preference,
- Object newValue) {
- String value = (String) newValue;
- System.out.println("La ville a change : " + value);
- user.setCity(value);
- update();
- return true;
- }
- });
-
- genre.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- public boolean onPreferenceChange(Preference preference,
- Object newValue) {
- Boolean value = (Boolean) newValue;
- String gender = null;
- if (value) {
- gender = "1";
- } else {
- gender = "0";
- }
-
- System.out.println("Le genre a change : " + gender);
- user.setGender(gender);
- update();
- return true;
- }
- });
-
- email.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- public boolean onPreferenceChange(Preference preference,
- Object newValue) {
- String value = (String) newValue;
- System.out.println("L'émail à change : " + value);
- //user.setEmail(value);
- update();
- return true;
- }
- });
-
-
- }
-
- public void update() {
- super.onResume();
- MainActivity _this = (MainActivity) this.getActivity();
- _this.isConnect();
-
- try {
- Account account = Account.getOwn();
- account.getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User user) {
- user.serverUpdate(new UpdateEvent<User>() {
-
- @Override
- public void onUpdate(User resource) {
- Toast.makeText(getActivity().getBaseContext(),
- "Profile mis à jour", Toast.LENGTH_SHORT)
- .show();
-
- }
-
- @Override
- public void errorResourceIdDoesNotExist() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void errorAdministratorRequired() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void errorAuthenticationRequired() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void errorNetwork() {
- // TODO Auto-generated method stub
-
- }
-
- });
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- getActivity().finish();
- }
-
- }
-}
\ No newline at end of file
package adullact.publicrowdfunding.controller.profile;
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.widget.ListView;
import android.widget.TextView;
+import java.util.ArrayList;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
+import adullact.publicrowdfunding.model.local.cache.Cache;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.profile;
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.widget.ListView;
import android.widget.TextView;
+import java.util.ArrayList;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
+import adullact.publicrowdfunding.model.local.cache.Cache;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+
/**
* @author Ferrand and Nelaupe
*/
public class ListFinancedProjectsFragment extends Fragment {
-
+
private ListView listeProjets;
private ArrayList<Project> projets;
private ArrayAdapter<Project> adapter;
+ private View view;
+
+ private TextView empty;
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
-
- final View view = inflater.inflate(
- R.layout.fragment_list_project_no_refresh, container, false);
+ view = inflater.inflate(R.layout.fragment_list_project_no_refresh,
+ container, false);
listeProjets = (ListView) view.findViewById(R.id.liste);
- TextView empty = (TextView) view.findViewById(R.id.empty);
+ empty = (TextView) view.findViewById(R.id.empty);
listeProjets.setEmptyView(empty);
projets = new ArrayList<Project>();
adapter = new ProjectAdaptor(this.getActivity().getBaseContext(),
R.layout.adaptor_project, projets, getActivity());
-
listeProjets.setAdapter(adapter);
listeProjets.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
- FragmentTransaction ft = getFragmentManager()
- .beginTransaction();
- // ft.setCustomAnimations(R.anim.enter_2, R.anim.exit);
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
+ //ft.setCustomAnimations(R.anim.enter_2, R.anim.exit);
Fragment fragment = new adullact.publicrowdfunding.controller.project.details.ProjectPagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", projets.get(position)
- .getResourceId());
- fragment.setArguments(bundle);
- fragment.setHasOptionsMenu(true);
+ Bundle bundle = new Bundle();
+ bundle.putString("idProject", projets.get(position).getResourceId());
+ fragment.setArguments(bundle);
+ fragment.setHasOptionsMenu(true);
ft.replace(R.id.content_frame, fragment);
ft.commit();
}
Bundle bundle = this.getArguments();
String idUser = bundle.getString("idUser");
+
+ Cache<User> cache = new User().getCache(idUser);
+ cache.toResource(new HoldToDo<User>() {
- Cache<User> cache = new User().getCache(idUser);
- cache.toResource(new HoldToDo<User>() {
-
- @Override
- public void hold(User resource) {
- resource.getFundedProjects(new HoldToDo<Project>() {
+ @Override
+ public void hold(User resource) {
+ resource.getFundedProjects(new HoldToDo<Project>() {
- @Override
- public void hold(Project resource) {
- projets.add(resource);
- adapter.notifyDataSetChanged();
- }
+ @Override
+ public void hold(Project resource) {
+ projets.add(resource);
+ adapter.notifyDataSetChanged();
+ }
- });
- }
-
- });
+ });
+ }
+ });
return view;
}
-
}
\ No newline at end of file
package adullact.publicrowdfunding.controller.profile;
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.widget.ListView;
import android.widget.TextView;
+import java.util.ArrayList;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
+import adullact.publicrowdfunding.model.local.cache.Cache;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.profile;
-import adullact.publicrowdfunding.R;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
+import adullact.publicrowdfunding.R;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.profile;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Share;
import android.app.FragmentTransaction;
import android.content.Context;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.profile.preferences;
-import adullact.publicrowdfunding.MainActivity;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.server.event.UpdateEvent;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.support.v4.preference.PreferenceFragment;
import android.widget.Toast;
+import adullact.publicrowdfunding.MainActivity;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.server.event.UpdateEvent;
+
/**
* @author Ferrand and Nelaupe
*/
--- /dev/null
+package adullact.publicrowdfunding.controller.project.add;
+
+import android.content.Context;
+import android.graphics.Typeface;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import adullact.publicrowdfunding.R;
+
+/**
+ * @author Ferrand and Nelaupe
+ */
+public class BreadCrumbView extends LinearLayout {
+
+ private TextView etape1;
+ private TextView etape2;
+ private TextView etape3;
+ private TextView etape4;
+
+ public BreadCrumbView(Context context) {
+ super(context);
+ init();
+ }
+
+ public BreadCrumbView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public BreadCrumbView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init();
+ }
+
+ private void init() {
+ inflate(getContext(), R.layout.bread_crump, this);
+
+ etape1 = (TextView) findViewById(R.id.etape1);
+ etape2 = (TextView) findViewById(R.id.etape2);
+ etape3 = (TextView) findViewById(R.id.etape3);
+ etape4 = (TextView) findViewById(R.id.etape4);
+ }
+
+ public void setPosition(int position) {
+
+ switch (position) {
+ case 1:
+ etape1.setTypeface(null, Typeface.BOLD);
+ etape2.setTypeface(null, Typeface.NORMAL);
+ etape3.setTypeface(null, Typeface.NORMAL);
+ etape4.setTypeface(null, Typeface.NORMAL);
+ break;
+ case 2:
+ etape1.setTypeface(null, Typeface.NORMAL);
+ etape2.setTypeface(null, Typeface.BOLD);
+ etape3.setTypeface(null, Typeface.NORMAL);
+ etape4.setTypeface(null, Typeface.NORMAL);
+ break;
+ case 3:
+ etape1.setTypeface(null, Typeface.NORMAL);
+ etape2.setTypeface(null, Typeface.NORMAL);
+ etape3.setTypeface(null, Typeface.BOLD);
+ etape4.setTypeface(null, Typeface.NORMAL);
+ break;
+ case 4:
+ etape1.setTypeface(null, Typeface.NORMAL);
+ etape2.setTypeface(null, Typeface.NORMAL);
+ etape3.setTypeface(null, Typeface.NORMAL);
+ etape4.setTypeface(null, Typeface.BOLD);
+ break;
+
+ }
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package adullact.publicrowdfunding.controller.project.add;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.utilities.Utility;
+
+/**
+ * @author Ferrand and Nelaupe
+ */
+public class addImageFragment extends Fragment {
+
+ private Context context;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ super.onCreateView(inflater, container, savedInstanceState);
+ View view = inflater.inflate(R.layout.fragment_add_image, container,
+ false);
+
+ context = this.getActivity().getApplicationContext();
+
+ BreadCrumbView breadCrumb = (BreadCrumbView) view.findViewById(R.id.breadcrumb);
+ breadCrumb.setPosition(2);
+
+ LinearLayout layout = (LinearLayout) view.findViewById(R.id.layout);
+
+
+ int size = Utility.getDrawableSize();
+ for(int i = 0; i < size ; i++){
+ ImageView image = new ImageView(context);
+ image.setImageDrawable(getResources().getDrawable(Utility.getDrawable(i)));
+ layout.addView(image,1);
+ layout.setId(i);
+ layout.setOnClickListener(new OnClickListener(){
+
+ @Override
+ public void onClick(View v) {
+ int id = v.getId();
+ nextStep(id);
+
+ }
+
+ });
+ }
+
+ return view;
+ }
+
+
+ public void nextStep(int id){
+ FragmentManager fm = getActivity().getSupportFragmentManager();
+ FragmentTransaction ft = fm.beginTransaction()
+ .disallowAddToBackStack();
+ Fragment fragment = new addLocationProjectFragment();
+
+ Bundle args = this.getArguments();
+
+ args.putInt("illustration", id);
+
+ fragment.setArguments(args);
+ fragment.setHasOptionsMenu(true);
+ ft.replace(R.id.content_frame, fragment);
+ ft.commit();
+
+ }
+
+}
\ No newline at end of file
package adullact.publicrowdfunding.controller.project.add;
-import adullact.publicrowdfunding.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.widget.TextView;
+import android.widget.Button;
import android.widget.Toast;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
+import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
+import adullact.publicrowdfunding.R;
+
/**
* @author Ferrand and Nelaupe
*/
public class addLocationProjectFragment extends Fragment implements
OnMapClickListener {
- private GoogleMap map;
private Marker marker;
+ View rootView;
+ GoogleMap googleMap;
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- View view = null;
- try {
- /*
- view = inflater.inflate(R.layout.activity_maps, container, false);
-
- map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
- .findFragmentById(R.id.)).getMap();
-
- map.setOnMapClickListener(this);
- map.setMyLocationEnabled(true);
-*/
- } catch (Exception e) {
- e.printStackTrace();
- TextView texte = new TextView(getActivity());
- texte.setText(R.string.error);
- view = texte;
+
+ if (rootView == null) {
+ rootView = inflater.inflate(R.layout.fragment_add_location,
+ container, false);
}
- marker = null;
- return view;
+ BreadCrumbView breadCrumbView = (BreadCrumbView) rootView
+ .findViewById(R.id.breadcrumb);
+ breadCrumbView.setPosition(3);
+
+ FragmentManager fm = getActivity().getSupportFragmentManager();
+
+ googleMap = ((SupportMapFragment) fm.findFragmentById(R.id.map))
+ .getMap();
+
+ googleMap.setOnMapClickListener(this);
+ googleMap.setMyLocationEnabled(true);
+
+ final Bundle args = this.getArguments();
+
+ Button button = (Button) rootView.findViewById(R.id.button_valider);
+
+ button.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ if (marker == null) {
+ Toast.makeText(
+ getActivity().getApplicationContext(),
+ "Cliquez sur la carte pour positionner votre projet",
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ FragmentTransaction ft = getActivity()
+ .getSupportFragmentManager().beginTransaction()
+ .disallowAddToBackStack();
+ Fragment fragment = new validationFragment();
+ args.putDouble("location_latitude",
+ marker.getPosition().latitude);
+ args.putDouble("location_longitude",
+ marker.getPosition().longitude);
+ fragment.setArguments(args);
+ fragment.setHasOptionsMenu(true);
+ ft.replace(R.id.content_frame, fragment);
+ ft.commit();
+
+ }
+
+ });
+
+ return rootView;
}
@Override
public void onMapClick(LatLng arg0) {
- Toast.makeText(getActivity().getApplicationContext(),
- "Emplacement de votre projet ajouté", Toast.LENGTH_SHORT)
- .show();
+
if (marker == null) {
- marker = map.addMarker(new MarkerOptions().position(arg0).title(
- "Votre projet"));
+ marker = googleMap.addMarker(new MarkerOptions().position(arg0)
+ .title("Votre projet"));
+ Toast.makeText(getActivity().getApplicationContext(),
+ "Emplacement de votre projet ajouté", Toast.LENGTH_SHORT)
+ .show();
} else {
marker.remove();
- marker = map.addMarker(new MarkerOptions().position(arg0).title(
- "Votre projet"));
+ marker = googleMap.addMarker(new MarkerOptions().position(arg0)
+ .title("Votre projet"));
+ Toast.makeText(getActivity().getApplicationContext(),
+ "Emplacement modifié", Toast.LENGTH_SHORT).show();
}
}
- public LatLng getPosition() {
- return marker.getPosition();
- }
-
}
\ No newline at end of file
package adullact.publicrowdfunding.controller.project.add;
-import java.util.ArrayList;
-import java.util.Calendar;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.adaptor.CarouselAdaptor;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
-import com.google.android.gms.maps.model.LatLng;
-import com.touchmenotapps.carousel.simple.HorizontalCarouselLayout;
-import com.touchmenotapps.carousel.simple.HorizontalCarouselLayout.CarouselInterface;
-import com.touchmenotapps.carousel.simple.HorizontalCarouselStyle;
+import java.util.Calendar;
+
+import org.joda.time.DateTime;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.Utility;
/**
* @author Ferrand and Nelaupe
private Context context;
- private int m_illustration;
-
- private addLocationProjectFragment _map;
-
- private User user;
-
private ImageView avatar;
- private HorizontalCarouselStyle mStyle;
- private HorizontalCarouselLayout mCarousel;
- private CarouselAdaptor mAdapter;
- private ArrayList<Integer> mData;
-
- private LinearLayout loading;
-
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
context = this.getActivity().getApplicationContext();
+ BreadCrumbView breadCrumb = (BreadCrumbView) view
+ .findViewById(R.id.breadcrumb);
+ breadCrumb.setPosition(1);
+
m_titre = (EditText) view.findViewById(R.id.titre);
m_Description = (EditText) view.findViewById(R.id.description);
m_dateFin = (DatePicker) view.findViewById(R.id.date_de_fin);
avatar = (ImageView) view.findViewById(R.id.avatar);
- mCarousel = (HorizontalCarouselLayout) view
- .findViewById(R.id.carousel_layout);
-
- loading = (LinearLayout) view.findViewById(R.id.loading);
-
- mCarousel.setOnCarouselViewChangedListener(new CarouselInterface() {
-
- @Override
- public void onItemChangedListener(View v, int position) {
- m_illustration = position;
- }
- });
-
m_valider.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- /*
- * Validation
- */
+ addProjectRequest();
+
}
});
}
String StrDay = "" + day;
- LatLng position = new LatLng(0, 0);
+ String endDate = Stryear + "-" + StrMonth + "-" + StrDay + " 00:00:00";
+
try {
- position = _map.getPosition();
- } catch (NullPointerException e) {
- e.printStackTrace();
+ DateTime endDateTime = Utility.stringToDateTime(endDate);
+ DateTime now = DateTime.now();
+ if (endDateTime.isBefore(now)) {
+ throw new Exception();
+ }
+ } catch (Exception e) {
+ Toast.makeText(context, "Date de fin invalide", Toast.LENGTH_SHORT)
+ .show();
+ return;
}
- new Project(titre, description, user.getResourceId(), somme,
- Utility.stringToDateTime(Stryear + "-" + StrMonth + "-"
- + StrDay + " 00:00:00"),
- Utility.stringToDateTime(Stryear + "-" + StrMonth + "-"
- + StrDay + " 00:00:00"), position, m_illustration,
- m_email.getText().toString(), m_website.getText().toString(),
- m_phone.getText().toString(), false)
- .serverCreate(new CreateEvent<Project>() {
- @Override
- public void errorResourceIdAlreadyUsed() {
-
- Toast.makeText(context, R.string.error,
- Toast.LENGTH_SHORT).show();
- }
- @Override
- public void onCreate(Project resource) {
+ FragmentTransaction ft = getActivity().getSupportFragmentManager()
+ .beginTransaction().disallowAddToBackStack();
+ Fragment fragment = new addImageFragment();
+ Bundle args = new Bundle();
- Toast.makeText(context, R.string.error,
- Toast.LENGTH_SHORT).show();
- }
+ args.putString("title", titre);
+ args.putString("description", description);
+ args.putString("somme", somme);
+ args.putString("endDate", endDate);
- @Override
- public void errorAuthenticationRequired() {
- Toast.makeText(context, "Vous devez vous authentifier",
- Toast.LENGTH_SHORT).show();
-
- }
+ if (m_email.length() > 0) {
+ String email = m_email.getText().toString();
+ args.putString("email", email);
+ }
- @Override
- public void errorNetwork() {
- Toast.makeText(context, R.string.error,
- Toast.LENGTH_SHORT).show();
-
- }
+ if (m_phone.length() > 0) {
+ String phone = m_phone.getText().toString();
+ args.putString("phone", phone);
+ }
- @Override
- public void errorServer() {
- Toast.makeText(context, R.string.error,
- Toast.LENGTH_SHORT).show();
+ if (m_website.length() > 0) {
+ String website = m_website.getText().toString();
+ args.putString("website", website);
+ }
- }
- });
+ fragment.setArguments(args);
+ fragment.setHasOptionsMenu(true);
+ ft.replace(R.id.content_frame, fragment);
+ ft.commit();
}
}
- public void loadMaps() {
- try {
- FragmentManager fm = getActivity().getSupportFragmentManager();
- FragmentTransaction ft = fm.beginTransaction();
- Fragment fragment = new addLocationProjectFragment();
- ft.replace(R.id.mapView, fragment);
- ft.commit();
- _map = (addLocationProjectFragment) fragment;
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
public void loadContent() {
- new Thread(new Runnable() {
-
- @Override
- public void run() {
-
- try {
- Account compte = Account.getOwn();
- compte.getUser(new HoldToDo<User>() {
-
- @Override
- public void hold(User resource) {
-
- user = resource;
-
-
- m_user_pseudo.setText(resource.getPseudo());
- m_user_ville.setText(resource.getCity());
- if (resource.getGender().equals("0")) {
- avatar.setImageResource(R.drawable.male_user_icon);
- } else {
- avatar.setImageResource(R.drawable.female_user_icon);
- }
-
- }
+ try {
+ Account compte = Account.getOwn();
+ compte.getUser(new HoldToDo<User>() {
+
+ @Override
+ public void hold(User resource) {
+
+ m_user_pseudo.setText(resource.getPseudo());
+ m_user_ville.setText(resource.getCity());
+ if (resource.getGender().equals("0")) {
+ avatar.setImageResource(R.drawable.male_user_icon);
+ } else {
+ avatar.setImageResource(R.drawable.female_user_icon);
+ }
- });
- } catch (NoAccountExistsInLocal e) {
- e.printStackTrace();
}
- m_illustration = 0;
-
- mData = new ArrayList<Integer>();
- mData.add(R.drawable.ic_launcher);
- mData.add(R.drawable.roi);
- mData.add(R.drawable.basketball);
- mData.add(R.drawable.plante);
- mData.add(R.drawable.fete);
-
- mAdapter = new CarouselAdaptor(context);
- mAdapter.setData(mData);
- mStyle = new HorizontalCarouselStyle(context,
- HorizontalCarouselStyle.NO_STYLE);
- mCarousel.setStyle(mStyle);
- mCarousel.setAdapter(mAdapter);
-
- supprimerCalendarView();
- loading.setVisibility(View.GONE);
-
- }
- }).start();
+ });
+ } catch (NoAccountExistsInLocal e) {
+ e.printStackTrace();
+ }
- loadMaps();
+ supprimerCalendarView();
}
+
}
\ No newline at end of file
--- /dev/null
+package adullact.publicrowdfunding.controller.project.add;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.android.gms.maps.model.LatLng;
+
+import org.joda.time.DateTime;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.Utility;
+import adullact.publicrowdfunding.model.server.event.CreateEvent;
+
+/**
+ * @author Ferrand and Nelaupe
+ */
+public class validationFragment extends Fragment {
+
+ private Context context;
+
+ private ImageView checkbox;
+ private TextView message;
+
+ private String m_titre;
+ private String m_description;
+ private String m_somme;
+ private DateTime m_endDateTime;
+ private int m_illustration;
+ private LatLng m_location;
+ private String m_email;
+ private String m_phone;
+ private String m_website;
+
+ private String m_userId;
+
+ private boolean m_isAdmin;
+
+ private View view;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ super.onCreateView(inflater, container, savedInstanceState);
+ view = inflater.inflate(R.layout.fragment_add_validation,
+ container, false);
+
+ BreadCrumbView breadCrumbView = (BreadCrumbView) view
+ .findViewById(R.id.breadcrumb);
+ breadCrumbView.setPosition(4);
+
+ context = this.getActivity().getBaseContext();
+
+ message = (TextView) view.findViewById(R.id.message);
+ checkbox = (ImageView) view.findViewById(R.id.checkbox);
+
+ Bundle args = this.getArguments();
+
+ m_titre = args.getString("title");
+ m_description = args.getString("description");
+ m_somme = args.getString("somme");
+ String endDate = args.getString("endDate");
+
+ m_endDateTime = Utility.stringToDateTime(endDate);
+
+ m_email = null;
+ try {
+ m_email = args.getString("email");
+ } catch (NullPointerException e) {
+ System.out.println("Pas d'email ajouté !");
+ }
+
+ m_phone = null;
+ try {
+ m_phone = args.getString("phone");
+ } catch (NullPointerException e) {
+ System.out.println("Pas de téléphone ajouté !");
+ }
+
+ m_website = null;
+ try {
+ m_website = args.getString("website");
+ } catch (NullPointerException e) {
+ System.out.println("Pas de site internet ajouté !");
+ }
+
+ m_illustration = args.getInt("illustration");
+
+ Double longitude = args.getDouble("location_longitude");
+ Double latitude = args.getDouble("location_latitude");
+ m_location = new LatLng(latitude, longitude);
+
+ try {
+
+ Account compte = Account.getOwn();
+ m_isAdmin = compte.isAdmin();
+ compte.getUser(new HoldToDo<User>() {
+
+ @Override
+ public void hold(User resource) {
+
+ m_userId = resource.getResourceId();
+
+ push();
+
+ }
+
+ });
+ } catch (NoAccountExistsInLocal e) {
+ e.printStackTrace();
+ }
+
+ return view;
+ }
+
+ public void push() {
+
+ new Project(m_titre, m_description, m_userId, m_somme,
+ m_endDateTime, m_location, m_illustration, m_email, m_website,
+ m_phone, m_isAdmin).serverCreate(new CreateEvent<Project>() {
+ @Override
+ public void errorResourceIdAlreadyUsed() {
+
+ Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT)
+ .show();
+ }
+
+ @Override
+ public void onCreate(Project resource) {
+ Drawable checked = context.getResources().getDrawable(
+ R.drawable.checkbox_ok);
+ checkbox.setImageDrawable(checked);
+ checkbox.invalidate();
+
+ if(m_isAdmin){
+ message.setText("Projet ajouté, le financement commence.");
+ }else{
+ message.setText("Projet soumis : en attente de validation.");
+ }
+
+ }
+
+ @Override
+ public void errorAuthenticationRequired() {
+ Toast.makeText(context, "Vous devez vous authentifier",
+ Toast.LENGTH_SHORT).show();
+
+ }
+
+ @Override
+ public void errorNetwork() {
+ Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT)
+ .show();
+
+ }
+
+ @Override
+ public void errorServer() {
+ Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT)
+ .show();
+
+ }
+
+ @Override
+ public void errorAdministratorRequired() {
+ Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT)
+ .show();
+ }
+ });
+ }
+
+}
\ No newline at end of file
package adullact.publicrowdfunding.controller.project.all;
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
-import adullact.publicrowdfunding.controller.project.details.ProjectPagerFragment;
-import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.Context;
import android.widget.SearchView.OnCloseListener;
import android.widget.SearchView.OnQueryTextListener;
+import java.util.ArrayList;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.adaptor.ProjectAdaptor;
+import adullact.publicrowdfunding.controller.project.details.ProjectPagerFragment;
+import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.project.all;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.adaptor.MarkerWindowAdaptor;
+import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
+
/**
* @author Ferrand and Nelaupe
*/
googleMap.setOnInfoWindowClickListener(_this);
googleMap
- .setInfoWindowAdapter(new adullact.publicrowdfunding.controller.adaptor.MarkerWindowAdaptor(
+ .setInfoWindowAdapter(new MarkerWindowAdaptor(this.getActivity().getBaseContext(),
getLayoutInflater(null), markers));
googleMap.setMyLocationEnabled(true);
package adullact.publicrowdfunding.controller.project.details;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Commentary;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
import android.content.Context;
-import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
-import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.RatingBar;
import android.widget.Toast;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Commentary;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.server.event.CreateEvent;
+
/**
* @author Ferrand and Nelaupe
*/
private EditText comment_title;
private EditText comment_message;
- private CheckBox conditions;
private Button valider;
private Animation shake;
mark = (RatingBar) view.findViewById(R.id.mark);
- conditions = (CheckBox) view.findViewById(R.id.conditions);
valider = (Button) view.findViewById(R.id.valider);
shake = AnimationUtils.loadAnimation(this.getActivity()
@Override
public void onClick(View v) {
- if (!conditions.isChecked()) {
- conditions.setTextColor(Color.parseColor("#ff0000"));
- return;
- }
if (comment_title.getText().length() < 1) {
comment_title.startAnimation(shake);
}
- });
+ @Override
+ public void errorAdministratorRequired() {
+ Toast.makeText(context,
+ R.string.error,
+ Toast.LENGTH_SHORT).show();
+ back();
+ }
+ });
} catch (NoAccountExistsInLocal e) {
Toast.makeText(context, R.string.error,
Toast.LENGTH_SHORT).show();
package adullact.publicrowdfunding.controller.project.details;
-import java.util.ArrayList;
-import java.util.Locale;
-
-import org.joda.time.DateTime;
-import org.joda.time.Interval;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.FundingInterval;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
+import org.joda.time.DateTime;
+import org.joda.time.Interval;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.utilities.FundingInterval;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.project.details;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Share;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.cache.Cache;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.Share;
+import adullact.publicrowdfunding.model.local.utilities.Utility;
/**
* @author Ferrand and Nelaupe
private Button m_website;
private Button m_call;
- //private ImageView m_illustration;
+ private ImageView m_illustration;
private ImageView m_avatar;
private Project projetToDisplay;
m_website = (Button) view.findViewById(R.id.website);
m_call = (Button) view.findViewById(R.id.phone);
- //m_illustration = (ImageView) view.findViewById(R.id.icon);
+ m_illustration = (ImageView) view.findViewById(R.id.icon);
m_avatar = (ImageView) view.findViewById(R.id.avatar);
} else{
this.getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
}
-
return view;
}
}
public void displayInfo() {
- /*
+
if (projetToDisplay.getIllustration() != 0) {
m_illustration.setImageResource(Utility.getDrawable(projetToDisplay
.getIllustration()));
} else {
m_illustration.setImageResource(R.drawable.ic_launcher);
- }*/
+ }
if (projetToDisplay.getEmail() == null
|| projetToDisplay.getEmail().length() == 0) {
package adullact.publicrowdfunding.controller.project.details;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.adaptor.CommentsAdaptor;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Commentary;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.ListView;
import android.widget.TextView;
+import java.util.ArrayList;
+import java.util.Vector;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.adaptor.CommentsAdaptor;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.cache.Cache;
+import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.Commentary;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.project.details;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.cache.Cache;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.project.details;
-import adullact.publicrowdfunding.R;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
+import adullact.publicrowdfunding.R;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.project.details;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.project.participate.PaypalActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.FrameLayout;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.project.participate.PaypalActivity;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.project.details;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Bookmark;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.CanI;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
-import adullact.publicrowdfunding.model.server.event.DeleteEvent;
import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.view.ViewGroup;
import android.widget.Toast;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.Bookmark;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.local.utilities.CanI;
+import adullact.publicrowdfunding.model.server.event.CreateEvent;
+import adullact.publicrowdfunding.model.server.event.DeleteEvent;
+
/**
* @author Ferrand and Nelaupe
*/
}
+ @Override
+ public void errorAdministratorRequired() {
+ // TODO Auto-generated method stub
+
+ }
+
});
}
package adullact.publicrowdfunding.controller.project.participate;
-import java.math.BigDecimal;
-
-import org.json.JSONException;
-
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import com.paypal.android.sdk.payments.PaymentActivity;
import com.paypal.android.sdk.payments.PaymentConfirmation;
+import org.json.JSONException;
+
+import java.math.BigDecimal;
+
public class PaypalActivity extends Activity {
private int participation;
package adullact.publicrowdfunding.controller.project.validate;
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.widget.ListView;
import android.widget.TextView;
+import java.util.ArrayList;
+
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.local.utilities.SyncServerToLocal;
+
/**
* @author Ferrand and Nelaupe
*/
@Override
public void holdAll(ArrayList<Project> projects) {
-
- adapter = new ValidateProjectAdaptor(getActivity().getBaseContext(),
+ adapter = new ValidateProjectAdaptor(getActivity().getBaseContext(),
R.layout.adaptor_project, sync.restrictToNotValidatedProjects());
- adapter.clear();
- adapter.addAll(projects);
+ /*adapter.clear();
+ adapter.addAll(notValidatedProject);*/
adapter.notifyDataSetChanged();
swipeView.setRefreshing(false);
package adullact.publicrowdfunding.controller.project.validate;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
import java.util.ArrayList;
import adullact.publicrowdfunding.R;
import adullact.publicrowdfunding.model.local.utilities.Share;
import adullact.publicrowdfunding.model.local.utilities.Utility;
import adullact.publicrowdfunding.views.CustomProgressBar;
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.TextView;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.controller.project.validate;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.server.event.UpdateEvent;
import android.os.Bundle;
-import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.KeyEvent;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
import android.widget.Button;
+import android.widget.FrameLayout;
import android.widget.RadioGroup;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Project;
+import adullact.publicrowdfunding.model.server.event.UpdateEvent;
+
/**
* @author Ferrand and Nelaupe
*/
case R.id.reject:
currentProject.setValidate(false);
update();
+ break;
default:
return;
}
.beginTransaction();
ft.setCustomAnimations(R.anim.no_anim, R.anim.popup_exit);
ft.remove(_this);
- ft.commit();
-
- // Multi Thread pour que l'animation s'éxécute
-
- new Handler().postDelayed(new Runnable() {
- public void run() {
- try {
- getActivity().getWindow().getDecorView()
- .findViewById(R.id.big_filter)
- .setVisibility(View.GONE);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }, 500);
+ FrameLayout filter = (FrameLayout) getActivity().getWindow()
+ .getDecorView().findViewById(R.id.big_filter);
+ Animation fadeInAnimation = AnimationUtils.loadAnimation(
+ _this.getActivity(), R.anim.fade_exit);
+ filter.setAnimation(fadeInAnimation);
+ ft.commit();
+ filter.animate();
}
public void update(){
+
currentProject.serverUpdate(new UpdateEvent<Project>(){
@Override
package adullact.publicrowdfunding.controller.register;
-import adullact.publicrowdfunding.MainActivity;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.server.event.AuthenticationEvent;
-import adullact.publicrowdfunding.model.server.request.AuthenticationRequest;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.widget.LinearLayout;
import android.widget.Toast;
+import adullact.publicrowdfunding.MainActivity;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
+import adullact.publicrowdfunding.model.local.callback.HoldToDo;
+import adullact.publicrowdfunding.model.local.ressource.Account;
+import adullact.publicrowdfunding.model.local.ressource.User;
+import adullact.publicrowdfunding.model.server.event.AuthenticationEvent;
+import adullact.publicrowdfunding.model.server.request.AuthenticationRequest;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.controller.register;
-import adullact.publicrowdfunding.MainActivity;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.controller.project.all.ListProjectsFragment;
-import adullact.publicrowdfunding.model.server.event.RegistrationEvent;
-import adullact.publicrowdfunding.model.server.request.RegistrationRequest;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.LinearLayout;
import android.widget.Toast;
+import adullact.publicrowdfunding.MainActivity;
+import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.controller.project.all.ListProjectsFragment;
+import adullact.publicrowdfunding.model.server.event.RegistrationEvent;
+import adullact.publicrowdfunding.model.server.request.RegistrationRequest;
+
/**
* @author Ferrand and Nelaupe
*/
view.setFocusableInTouchMode(true);
view.requestFocus();
- view.setOnKeyListener( new OnKeyListener()
- {
- @Override
- public boolean onKey( View v, int keyCode, KeyEvent event )
- {
- if( keyCode == KeyEvent.KEYCODE_BACK )
- {
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new ConnexionFragment();
- ft.replace(R.id.big_font, fragment);
-
- ft.commit();
- return true;
- }
- return false;
- }
- } );
-
+
return view;
}
+++ /dev/null
-package adullact.publicrowdfunding.controller.validateProject;
-
-import adullact.publicrowdfunding.R;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-public class MainActivity extends Fragment {
-
- public MainActivity() {
-
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.activity_register, container, false);
-
-
- getActivity().setTitle("");
- return rootView;
- }
-}
+++ /dev/null
-package adullact.publicrowdfunding.custom;\r
-\r
-import java.util.ArrayList;\r
-\r
-import android.content.Context;\r
-import android.view.View;\r
-import android.view.ViewGroup;\r
-import android.widget.BaseAdapter;\r
-import android.widget.ImageView;\r
-\r
-public class CarouselAdaptor extends BaseAdapter {\r
- \r
- private ArrayList<Integer> mData = new ArrayList<Integer>(0);\r
- private Context mContext;\r
-\r
- public CarouselAdaptor(Context context) {\r
- mContext = context;\r
- }\r
- \r
- public void setData(ArrayList<Integer> data) {\r
- mData = data;\r
- }\r
- \r
- @Override\r
- public int getCount() {\r
- return mData.size();\r
- }\r
-\r
- @Override\r
- public Object getItem(int pos) {\r
- return mData.get(pos);\r
- }\r
-\r
- @Override\r
- public long getItemId(int pos) {\r
- return pos;\r
- }\r
-\r
- @Override\r
- public View getView(int arg0, View arg1, ViewGroup arg2) {\r
- ImageView mImage= new ImageView(mContext);\r
- mImage.setImageResource(mData.get(arg0));\r
- mImage.setScaleX((float) 1.7);\r
- mImage.setScaleY((float) 1.7);\r
- return mImage;\r
- }\r
- \r
-}\r
+++ /dev/null
-package adullact.publicrowdfunding.custom;
-
-import java.util.Vector;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Commentary;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnTouchListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.RatingBar;
-import android.widget.TextView;
-
-/**
- *
- * @author warting {@link https://github.com/warting/AndroidChatBubbles}
- *
- */
-public class CommentsAdaptor extends ArrayAdapter<Commentary> {
-
- private TextView commentaire;
- private TextView utilisateurName;
- private TextView utilisateurVille;
- private RatingBar rating;
- private TextView titre;
- private Vector<Commentary> commentaries = new Vector<Commentary>();
- private ImageView avatar;
- private CommentsAdaptor _this;
-
- public void setCommentaries(Vector<Commentary> object) {
- commentaries = object;
- _this = this;
- }
-
- public CommentsAdaptor(Context context, int textViewResourceId) {
- super(context, textViewResourceId);
- this.notifyDataSetChanged();
- }
-
- public int getCount() {
- return this.commentaries.size();
- }
-
- public Commentary getItem(int index) {
- return this.commentaries.get(index);
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- View row = convertView;
-
- LayoutInflater inflater = null;
- if (row == null) {
- inflater = (LayoutInflater) this.getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- row = inflater.inflate(R.layout.adaptor_comment, parent, false);
- }
-
- Commentary coment = getItem(position);
-
- commentaire = (TextView) row.findViewById(R.id.comment);
- commentaire.setText(coment.getMessage());
-
- titre = (TextView) row.findViewById(R.id.titre);
- titre.setText(coment.getTitle());
-
- utilisateurVille = (TextView) row.findViewById(R.id.utilisateur_ville);
-
- avatar = (ImageView) row.findViewById(R.id.avatar);
-
- rating = (RatingBar) row.findViewById(R.id.rating);
- rating.setRating((float) coment.getMark());
- rating.setOnTouchListener(new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- // TODO Auto-generated method stub
- return true;
- }
- });
- rating.setFocusable(false);
- utilisateurName = (TextView) row.findViewById(R.id.utilisateur_name);
- coment.getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- utilisateurName.setText(resource.getPseudo());
- utilisateurVille.setText(resource.getCity());
- if (resource.getGender().equals("0")) {
- avatar.setImageResource(R.drawable.male_user_icon);
- } else {
- avatar.setImageResource(R.drawable.female_user_icon);
- }
- _this.notifyDataSetChanged();
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
- }
-
- });
-
- return row;
- }
-
- public Bitmap decodeToBitmap(byte[] decodedByte) {
- return BitmapFactory
- .decodeByteArray(decodedByte, 0, decodedByte.length);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.custom;
-
-import java.util.HashMap;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.Calcul;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import adullact.publicrowdfunding.views.CustomProgressBar;
-import android.support.v4.app.FragmentActivity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
-import com.google.android.gms.maps.model.Marker;
-
-public class MarkerWindowAdaptor extends FragmentActivity implements InfoWindowAdapter {
-
- private TextView titre_projet_liste;
- private TextView description_projet_liste;
- private TextView temps_restant_projet_liste;
- private CustomProgressBar avancement_projet_liste;
- private ImageView illustration;
- private TextView sommeFunded;
- private TextView sommeDemander;
- private TextView distance;
-
- private final HashMap<Marker, Project> markers;
-
- private LayoutInflater inflater;
-
- public MarkerWindowAdaptor(LayoutInflater inflater, HashMap<Marker, Project> markers) {
- this.inflater=inflater;
- this.markers = markers;
-
- }
-
- public void displayInfo(Project projet) {
- titre_projet_liste.setText(projet.getName());
- description_projet_liste.setText(projet.getDescription());
- temps_restant_projet_liste.setText(projet.getNumberOfDayToEnd()
- + " jours");
-
- avancement_projet_liste.setProgress(projet.getPercentOfAchievement());
- sommeDemander.setText(projet.getRequestedFunding() + "€");
- sommeFunded.setText(projet.getCurrentFunding() + "€");
- if (projet.getIllustration() != 0) {
- illustration.setImageResource(Utility.getDrawable(projet
- .getIllustration()));
- } else {
- illustration.setImageResource(R.drawable.ic_launcher);
- }
-
- distance.setVisibility(View.GONE);
- try {
- distance.setText("Distance : "
- + Calcul.diplayDistance(Share.position,
- projet.getPosition()));
- distance.setVisibility(View.VISIBLE);
- } catch (NullPointerException e) {
- distance.setVisibility(View.GONE);
- }
- }
-
- @Override
- public View getInfoContents(Marker arg0) {
- View v = inflater.inflate(
- R.layout.fiche_project, null);
-
- titre_projet_liste = (TextView) v.findViewById(R.id.titre_projet_liste);
- description_projet_liste = (TextView) v
- .findViewById(R.id.description_projet_liste);
- temps_restant_projet_liste = (TextView) v
- .findViewById(R.id.nombre_jour_restant_detail);
- avancement_projet_liste = (CustomProgressBar) v
- .findViewById(R.id.avancement_projet_liste);
- illustration = (ImageView) v.findViewById(R.id.icon);
- sommeDemander = (TextView) v.findViewById(R.id.sommeeDemande);
-
- sommeFunded = (TextView) v.findViewById(R.id.sommeFund);
- distance = (TextView) v.findViewById(R.id.distance);
-
- displayInfo(markers.get(arg0));
-
- return v;
- }
-
- @Override
- public View getInfoWindow(Marker arg0) {
- return null;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.custom;
-
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.Calcul;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import adullact.publicrowdfunding.views.CustomProgressBar;
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class ProjectAdaptor extends ArrayAdapter<Project> {
-
- Context mContext;
- int layoutResourceId;
- ArrayList<Project> data;
-
- public ProjectAdaptor(Context context, int resource, ArrayList<Project> listItem) {
- super(context, resource, listItem);
- this.mContext = context;
- this.layoutResourceId = resource;
- this.data = listItem;
- }
-
- private static class UserHolder {
-
- public TextView titre_projet_liste;
- public TextView description_projet_liste;
- public TextView temps_restant_projet_liste;
- public CustomProgressBar avancement_projet_liste;
- public ImageView illustration;
- public TextView sommeFunded;
- public TextView sommeDemander;
- public TextView distance;
-
- }
-
- @Override
- public int getCount() {
- // TODO Auto-generated method stub
- return data.size();
- }
-
- public Project getItem(int index) {
- return this.data.get(index);
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- System.out.println("Adaptor du projet");
- UserHolder holder = new UserHolder();
-
- // First let's verify the convertView is not null
- if (convertView == null) {
- // This a new view we inflate the new layout
- LayoutInflater inflater = (LayoutInflater) mContext
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = inflater.inflate(layoutResourceId, null);
-
- holder.titre_projet_liste = (TextView) v
- .findViewById(R.id.titre_projet_liste);
- holder.description_projet_liste = (TextView) v
- .findViewById(R.id.description_projet_liste);
- holder.temps_restant_projet_liste = (TextView) v
- .findViewById(R.id.nombre_jour_restant_detail);
- holder.avancement_projet_liste = (CustomProgressBar) v
- .findViewById(R.id.avancement_projet_liste);
- holder.illustration = (ImageView) v.findViewById(R.id.icon);
- holder.sommeDemander = (TextView) v
- .findViewById(R.id.sommeeDemande);
-
- holder.sommeFunded = (TextView) v
- .findViewById(R.id.sommeFund);
- holder.distance = (TextView) v
- .findViewById(R.id.distance);
-
- v.setTag(holder);
- } else {
- holder = (UserHolder) v.getTag();
- }
-
- Project projet = data.get(position);
- holder.titre_projet_liste.setText(projet.getName());
- holder.description_projet_liste.setText(projet.getDescription());
- holder.temps_restant_projet_liste.setText(projet.getNumberOfDayToEnd()
- + " jours");
-
- holder.avancement_projet_liste.setProgress(projet
- .getPercentOfAchievement());
- holder.sommeDemander.setText(projet.getRequestedFunding()+"€");
- holder.sommeFunded.setText(projet.getCurrentFunding()+"€");
- if (projet.getIllustration() != 0) {
- holder.illustration.setImageResource(Utility.getDrawable(projet
- .getIllustration()));
- } else {
- holder.illustration.setImageResource(R.drawable.ic_launcher);
- }
-
- holder.distance.setVisibility(View.GONE);
- try{
- holder.distance.setText("Distance : "+Calcul.diplayDistance(Share.position, projet.getPosition()));
- holder.distance.setVisibility(View.VISIBLE);
- }catch(NullPointerException e){
- holder.distance.setVisibility(View.GONE);
- }
-
- return v;
-
- }
-}
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Commentary;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
-import android.content.Context;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnKeyListener;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.RatingBar;
-import android.widget.Toast;
-
-public class CommentPopup extends Fragment {
-
- private Fragment _this;
-
- private EditText comment_title;
- private EditText comment_message;
-
- private CheckBox conditions;
- private Button valider;
-
- private Animation shake;
-
- private RatingBar mark;
-
- private Project projet;
-
- private Context context;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
- View view = inflater.inflate(R.layout.popup_add_comment, container,
- false);
-
- _this = this;
- context = getActivity();
-
- Bundle bundle = this.getArguments();
- if (bundle != null) {
- String idProject = bundle.getString("idProject");
- getProject(idProject);
-
- } else {
- back();
- }
-
- comment_title = (EditText) view.findViewById(R.id.titre_comment);
- comment_message = (EditText) view.findViewById(R.id.message_comment);
-
- mark = (RatingBar) view.findViewById(R.id.mark);
-
- conditions = (CheckBox) view.findViewById(R.id.conditions);
- valider = (Button) view.findViewById(R.id.valider);
-
- shake = AnimationUtils.loadAnimation(this.getActivity()
- .getBaseContext(), R.anim.shake);
-
- valider.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- if (!conditions.isChecked()) {
- conditions.setTextColor(Color.parseColor("#ff0000"));
- return;
- }
-
- if (comment_title.getText().length() < 1) {
- comment_title.startAnimation(shake);
- return;
- }
-
- if (comment_message.getText().length() < 1) {
- comment_message.startAnimation(shake);
- return;
- }
-
- try {
- float rating = mark.getRating();
- if (rating < 1) {
- throw new Exception();
- }
- } catch (Exception e) {
- mark.startAnimation(shake);
- return;
- }
- commenter();
- }
-
- });
-
- view.setFocusableInTouchMode(true);
- view.requestFocus();
- view.setOnKeyListener(new OnKeyListener() {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
-
- back();
- return true;
- }
- return false;
- }
- });
-
- return view;
-
- }
-
- public void back() {
-
- FragmentTransaction ft = getActivity().getSupportFragmentManager()
- .beginTransaction();
- ft.setCustomAnimations(R.anim.no_anim, R.anim.popup_exit);
- ft.remove(_this);
- ft.commit();
-
- // Multi Thread pour que l'animation s'éxécute
-
- new Handler().postDelayed(new Runnable() {
- public void run() {
- try {
- getActivity().getWindow().getDecorView()
- .findViewById(R.id.alpha_comment)
- .setVisibility(View.GONE);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }, 500);
- }
-
- public void commenter() {
- String s_titre = comment_title.getText().toString();
- String s_message = comment_message.getText().toString();
- int rating = (int) mark.getRating();
-
- try {
- projet.postCommentary(s_titre, s_message, rating,
- new CreateEvent<Commentary>() {
-
- @Override
- public void errorResourceIdAlreadyUsed() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
- back();
- }
-
- @Override
- public void onCreate(Commentary resource) {
- Toast.makeText(context, "Commentaire ajouté !",
- Toast.LENGTH_SHORT).show();
- back();
-
- }
-
- @Override
- public void errorAuthenticationRequired() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
- back();
-
- }
-
- @Override
- public void errorNetwork() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
- back();
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- Toast.makeText(context, "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
- back();
- e.printStackTrace();
- }
-
- }
-
- public void getProject(String idProject) {
- new Project().getCache(idProject).forceRetrieve()
- .toResource(new HoldToDo<Project>() {
-
- @Override
- public void hold(Project resource) {
- projet = resource;
-
- }
-
- });
- }
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import java.util.ArrayList;
-
-import org.joda.time.DateTime;
-import org.joda.time.Interval;
-
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.utilities.FundingInterval;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Paint.Align;
-import android.graphics.Path;
-import android.util.AttributeSet;
-import android.view.View;
-
-/**
- * @author Nelaupe Lucas
- */
-public class GraphiqueView extends View {
-
- private Paint paint;
- private Project projet;
- private ArrayList<FundingInterval> graphData;
- private Path path;
-
- /**
- * @param context
- * The context of the application
- */
- public GraphiqueView(Context context) {
- super(context);
- paint = new Paint();
- path = new Path();
- graphData = new ArrayList<FundingInterval>();
- }
-
- /**
- * @param context
- * The context of the application
- * @param attrs
- * The attributs
- */
- public GraphiqueView(Context context, AttributeSet attrs) {
- super(context, attrs);
- paint = new Paint();
- graphData = new ArrayList<FundingInterval>();
- path = new Path();
- }
-
- public void setProject(Project projet) {
- this.projet = projet;
- }
-
- /**
- * Draw
- */
- protected void onDraw(Canvas canvas) {
-
- int largeur = canvas.getWidth() - 10;
- int hauteur = largeur;
- int offset = 100; // décalement vertical
-
- int nombreDeCarre = 10;
- for (int i = 0; i < nombreDeCarre + 1; i++) {
-
- if (i == 0) {
- paint.setColor(Color.rgb(109, 195, 41));
- }
-
- // Horizontal
- canvas.drawLine(0, i * (largeur / nombreDeCarre) + offset, largeur,
- i * (largeur / nombreDeCarre) + offset, paint);
- // Vertical
- paint.setColor(Color.rgb(210, 210, 210));
- canvas.drawLine(i * (largeur / nombreDeCarre), offset, i
- * (largeur / nombreDeCarre), largeur + offset, paint);
-
- }
-
- if (projet == null) {
- return;
- }
-
- graphData = projet.getFundingIntervals();
-
- paint.reset();
- int xPos = (int) (canvas.getWidth() / 2);
- int yPos = offset / 2;
- paint.setTextAlign(Align.CENTER);
- paint.setTextSize(40);
- paint.setColor(Color.rgb(128, 128, 128));
- canvas.drawText("Progression du financement", xPos, yPos, paint);
-
- paint.reset();
- // Ajout texte 100 %
- xPos = (int) (6 * canvas.getWidth() / 10);
- yPos = offset - 20;
- paint.setTextSize(20);
- paint.setColor(Color.rgb(109, 195, 41));
- canvas.drawText("100 %", xPos, yPos, paint);
-
- paint.reset();
- // Ajout date de début
- xPos = 0;
- yPos = offset - 20;
- paint.setTextSize(20);
- paint.setColor(Color.rgb(160, 160, 160));
- Interval in = projet.getFundingInterval();
-
- DateTime dateStart = in.getStart();
- String month = "";
- if (dateStart.getMonthOfYear() < 10) {
- month = "0" + dateStart.getMonthOfYear();
- } else {
- month = "" + dateStart.getMonthOfYear();
- }
-
- String monthEnd = "";
- DateTime dateEnd = in.getEnd();
- if (dateEnd.getMonthOfYear() < 10) {
- monthEnd = "0" + dateEnd.getMonthOfYear();
- } else {
- monthEnd = "" + dateEnd.getMonthOfYear();
- }
-
- canvas.drawText(dateStart.getDayOfMonth() + "/" + month + "/"
- + dateStart.getYear(), xPos, yPos, paint);
-
- paint.reset();
- // Ajout date de fin
- xPos = (int) (canvas.getWidth() - 120);
- yPos = offset - 20;
- paint.setTextSize(20);
- paint.setColor(Color.rgb(160, 160, 160));
- canvas.drawText(dateEnd.getDayOfMonth() + "/" + monthEnd + "/"
- + dateEnd.getYear(), xPos, yPos, paint);
-
- // Exemple de coubre
- long pourcentageAccomplie = 0;
-
- int nbIteration = projet.getNbPeriod();
- long somme = 0;
- for (int i = 0; i < nbIteration; i++) {
- long data = 0;
- try {
- if (graphData.get(i).getTotal() == -1) {
- break;
- }
- data = graphData.get(i).getTotal();
- } catch (Exception e) {
- e.printStackTrace();
- break;
- }
-
- somme += data;
- long pourcentage = 0;
- try {
- pourcentage = (somme * 100)
- / Long.parseLong(projet.getRequestedFunding());
- } catch (ArithmeticException e) {
- e.printStackTrace();
- }
- long newPourcentage = pourcentage;
- if (newPourcentage > 100) {
- newPourcentage = 100;
- }
-
- long yDepart = largeur - ((pourcentageAccomplie * hauteur) / 100)
- + offset;
- long yArrive = largeur - ((newPourcentage * hauteur) / 100)
- + offset;
-
- int xDepart = i * (largeur / nombreDeCarre);
- int xArrive = (i + 1) * (largeur / nombreDeCarre);
- if (xArrive > largeur) {
- break;
- }
-
- paint.reset();
- paint.setColor(Color.argb(150, 131, 182, 255));
-
- path.reset();
- path.setFillType(Path.FillType.EVEN_ODD);
- path.moveTo(xDepart, yDepart);
- path.lineTo(xArrive, yArrive);
- path.lineTo(xArrive, hauteur + offset);
- path.lineTo(xDepart, hauteur + offset);
- path.lineTo(xDepart, yDepart);
- path.close();
-
- canvas.drawPath(path, paint);
-
- // La ligne
- paint.reset();
- paint.setColor(Color.rgb(183, 0, 0));
- paint.setStrokeWidth(2);
- canvas.drawLine(xDepart, yDepart, xArrive, yArrive, paint);
-
- pourcentageAccomplie = newPourcentage;
- }
-
- }
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.Share;
-import adullact.publicrowdfunding.model.local.utilities.Utility;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.util.DisplayMetrics;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class InfoProjectFragment extends Fragment {
-
- private TextView m_titre;
- private TextView m_description;
- private TextView m_current_funding;
- private TextView m_jour_restant;
- private TextView m_utilisateur_soumission;
- private TextView m_pourcentage_accomplish;
- private TextView m_utilisateur_ville;
- private TextView m_request_funding;
-
- private Button m_payer;
- private Button m_mail;
- private Button m_website;
- private Button m_call;
-
- private ImageView m_illustration;
- private ImageView m_avatar;
-
- private Project projetToDisplay;
- private User user;
-
- private FrameLayout layoutConnect;
-
- private RelativeLayout layout_website;
- private RelativeLayout layout_call;
- private RelativeLayout layout_mail;
-
- private GraphiqueView graph;
-
- private View view;
-
- private FragmentManager fm;
-
- private LinearLayout loading;
-
- private FrameLayout filter;
-
- private FrameLayout showLoaded;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- view = inflater.inflate(R.layout.fragment_detail_project, container,
- false);
- fm = this.getActivity().getSupportFragmentManager();
-
- filter = (FrameLayout) view.findViewById(R.id.filter);
- filter.setVisibility(View.GONE);
- layoutConnect = (FrameLayout) view.findViewById(R.id.connect);
-
- showLoaded = (FrameLayout) view.findViewById(R.id.showLoaded);
- showLoaded.setVisibility(View.GONE);
-
- loading = (LinearLayout) view.findViewById(R.id.loading);
-
- layout_website = (RelativeLayout) view
- .findViewById(R.id.layout_website);
- layout_call = (RelativeLayout) view.findViewById(R.id.layout_call);
- layout_mail = (RelativeLayout) view.findViewById(R.id.layout_mail);
-
- graph = (GraphiqueView) view.findViewById(R.id.graphique);
- DisplayMetrics metrics = new DisplayMetrics();
- getActivity().getWindowManager().getDefaultDisplay()
- .getMetrics(metrics);
-
- android.view.ViewGroup.LayoutParams params = graph.getLayoutParams();
- params.height = metrics.widthPixels + 100;
- graph.setLayoutParams(params);
-
- m_titre = (TextView) view.findViewById(R.id.titre_projet_detail);
- m_description = (TextView) view.findViewById(R.id.detail_projet_detail);
- m_payer = (Button) view.findViewById(R.id.payer);
- m_jour_restant = (TextView) view
- .findViewById(R.id.nombre_jour_restant_detail);
- m_utilisateur_soumission = (TextView) view
- .findViewById(R.id.utilisateur_soumission);
- m_current_funding = (TextView) view.findViewById(R.id.sommeFund);
- m_pourcentage_accomplish = (TextView) view
- .findViewById(R.id.pourcentage_accomplit);
- m_utilisateur_ville = (TextView) view.findViewById(R.id.ville);
- m_request_funding = (TextView) view.findViewById(R.id.sommeRequestFund);
-
- m_mail = (Button) view.findViewById(R.id.mail);
- m_website = (Button) view.findViewById(R.id.website);
- m_call = (Button) view.findViewById(R.id.phone);
-
- m_illustration = (ImageView) view.findViewById(R.id.icon);
-
- m_avatar = (ImageView) view.findViewById(R.id.avatar);
-
- isConnect();
-
- Bundle bundle = this.getArguments();
- if (bundle != null) {
- String idProject = bundle.getString("idProject");
- Cache<Project> projet = new Project().getCache(idProject)
- .forceRetrieve();
- projet.toResource(new HoldToDo<Project>() {
- @Override
- public void hold(Project project) {
- projetToDisplay = project;
- graph.setProject(projetToDisplay);
- graph.invalidate();
- displayInfo();
- }
- });
- } else {
- getActivity().finish();
- }
-
- return view;
- }
-
- public void isConnect() {
- try {
- Account.getOwn();
- layoutConnect.setVisibility(View.VISIBLE);
- } catch (NoAccountExistsInLocal e1) {
- // layoutConnect.setVisibility(View.GONE);
- }
- }
-
- public void displayInfo() {
- if (projetToDisplay.getIllustration() != 0) {
- m_illustration.setImageResource(Utility.getDrawable(projetToDisplay
- .getIllustration()));
- } else {
- m_illustration.setImageResource(R.drawable.ic_launcher);
- }
-
- if (projetToDisplay.getEmail() == null
- || projetToDisplay.getEmail().length() == 0) {
- layout_mail.setVisibility(View.GONE);
- } else {
- m_mail.setText(projetToDisplay.getEmail());
- }
-
- if (projetToDisplay.getWebsite() == null
- || projetToDisplay.getWebsite().length() == 0) {
- layout_website.setVisibility(View.GONE);
- } else {
- m_website.setText(projetToDisplay.getWebsite());
- }
-
- if (projetToDisplay.getPhone() == null
- || projetToDisplay.getPhone().length() == 0) {
- layout_call.setVisibility(View.GONE);
- } else {
- m_call.setText(projetToDisplay.getPhone());
- }
-
- m_request_funding.setText(projetToDisplay.getRequestedFunding() + "€");
-
- projetToDisplay.getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- try {
- user = resource;
- m_utilisateur_soumission.setText(Share
- .formatString(resource.getPseudo()));
- m_utilisateur_ville.setText(Share.formatString(resource
- .getCity()));
- if (user.getGender().equals("0")) {
- m_avatar.setImageResource(R.drawable.male_user_icon);
- } else {
- m_avatar.setImageResource(R.drawable.female_user_icon);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- @Override
- public void eventually() {
-
- }
-
- });
-
- LinearLayout userLayoutButton = (LinearLayout) view
- .findViewById(R.id.layoutUser);
-
- userLayoutButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
-
- try {
-
- FragmentTransaction ft = fm.beginTransaction();
-
- // ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.profile.ProfilePagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idUser", user.getResourceId());
- fragment.setArguments(bundle);
- fragment.setHasOptionsMenu(false);
- ft.addToBackStack(null);
- ft.replace(R.id.content_frame, fragment);
- ft.commit();
-
- } catch (NullPointerException e) {
- Toast.makeText(getActivity(), "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
- }
- }
- });
-
- m_pourcentage_accomplish.setText(projetToDisplay
- .getPercentOfAchievement() + "%");
- m_current_funding.setText(projetToDisplay.getCurrentFunding() + "€");
- projetToDisplay.getCreationDate();
- m_titre.setText(projetToDisplay.getName());
- m_description.setText(projetToDisplay.getDescription());
- if (projetToDisplay.getNumberOfDayToEnd() > 1) {
- m_jour_restant.setText("" + projetToDisplay.getNumberOfDayToEnd()
- + " jours");
- } else {
- m_jour_restant.setText("" + projetToDisplay.getNumberOfDayToEnd()
- + " jour");
- }
-
- m_payer.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
-
- FragmentTransaction ft = fm.beginTransaction();
-
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.ParticipatePopup();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", projetToDisplay.getResourceId());
- fragment.setArguments(bundle);
- ft.setCustomAnimations(R.anim.popup_enter, R.anim.no_anim);
- ft.add(R.id.front, fragment);
- ft.commit();
-
- filter.setVisibility(View.VISIBLE);
-
- }
- });
- showLoaded.setVisibility(View.VISIBLE);
- loading.setVisibility(View.GONE);
- //view.invalidate();
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import java.util.ArrayList;
-import java.util.Vector;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.custom.CommentsAdaptor;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Commentary;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.Button;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class ListCommentsFragment extends Fragment {
-
- private Button m_button_comment;
-
- private ListView lv;
-
- private Vector<Commentary> commentaries;
-
- private LinearLayout layoutConnect;
-
- protected CommentsAdaptor adapter;
-
- private SwipeRefreshLayout swipeView;
-
- private Project projetCurrent;
-
- private FragmentManager fm;
-
- private LinearLayout loading;
- private FrameLayout loaded;
-
- private FrameLayout filter;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- final View view = inflater.inflate(R.layout.fragment_list_comments,
- container, false);
-
-
- filter = (FrameLayout) view.findViewById(R.id.alpha_comment);
- filter.setVisibility(View.GONE);
-
- fm = this.getActivity().getSupportFragmentManager();
-
- layoutConnect = (LinearLayout) view.findViewById(R.id.connect);
- loaded = (FrameLayout) view.findViewById(R.id.showLoaded);
- loaded.setVisibility(View.GONE);
-
- loading = (LinearLayout) view.findViewById(R.id.loading);
-
- isConnect();
-
- commentaries = new Vector<Commentary>();
-
- lv = (ListView) view.findViewById(R.id.commentaires);
- adapter = new CommentsAdaptor(
- getActivity().getApplicationContext(), R.layout.adaptor_comment);
-
- adapter.setCommentaries(commentaries);
-
- lv.setAdapter(adapter);
-
- m_button_comment = (Button) view
- .findViewById(R.id.button_comment);
-
- TextView empty = (TextView) view.findViewById(R.id.empty);
- lv.setEmptyView(empty);
-
- Bundle bundle = this.getArguments();
- if (bundle != null) {
- String idProject = bundle.getString("idProject");
- Cache<Project> projet = new Project().getCache(idProject)
- .forceRetrieve();
- projet.toResource(new HoldToDo<Project>() {
- @Override
- public void hold(Project project) {
- projetCurrent = project;
- displayInfo();
- }
- });
- }
-
- swipeView = (SwipeRefreshLayout) view.findViewById(R.id.refresher);
- swipeView.setEnabled(false);
- swipeView.setColorScheme(R.color.blue, R.color.green, R.color.yellow,
- R.color.red);
- swipeView
- .setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- // refresh();
-
- }
-
- });
-
- lv.setOnScrollListener(new AbsListView.OnScrollListener() {
- @Override
- public void onScrollStateChanged(AbsListView absListView, int i) {
-
- }
-
- @Override
- public void onScroll(AbsListView absListView, int firstVisibleItem,
- int visibleItemCount, int totalItemCount) {
- if (firstVisibleItem == 0)
- swipeView.setEnabled(true);
- else
- swipeView.setEnabled(false);
- }
- });
-
- return view;
-
- }
-
- public void isConnect() {
- try {
- Account.getOwn();
- layoutConnect.setVisibility(View.VISIBLE);
- } catch (NoAccountExistsInLocal e1) {
- // layoutConnect.setVisibility(View.GONE);
- }
- }
-
- /*
- * public void refresh() { _this.refresh(); adapter.notifyDataSetChanged();
- * }
- */
-
- public void displayInfo() {
- projetCurrent.getCommentaries(new HoldAllToDo<Commentary>() {
-
- @Override
- public void holdAll(ArrayList<Commentary> resources) {
- commentaries = new Vector<Commentary>(resources);
-
- adapter.setCommentaries(commentaries);
- adapter.notifyDataSetChanged();
- loading.setVisibility(View.GONE);
- loaded.setVisibility(View.VISIBLE);
- }
- });
-
- lv.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
-
- Commentary com = commentaries.get(position);
- com.getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
-
- FragmentTransaction ft = fm.beginTransaction();
-
- // ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.profile.ProfilePagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idUser", resource.getResourceId());
- fragment.setArguments(bundle);
- fragment.setHasOptionsMenu(true);
- ft.replace(R.id.content_frame, fragment);
- ft.addToBackStack(null);
- ft.commit();
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
- });
-
- }
- });
-
- m_button_comment.setOnClickListener(new OnClickListener(){
-
- @Override
- public void onClick(View v) {
- // TODO Auto-generated method stub
- FragmentTransaction ft = fm.beginTransaction();
-
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.CommentPopup();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", projetCurrent.getResourceId());
- fragment.setArguments(bundle);
- ft.setCustomAnimations(R.anim.popup_enter, R.anim.no_anim);
- ft.add(R.id.front, fragment);
- ft.commit();
-
- filter.setVisibility(View.VISIBLE);
-
- }
-
- });
-
- }
-
-}
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.google.android.gms.maps.CameraUpdate;
-import com.google.android.gms.maps.CameraUpdateFactory;
-import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.SupportMapFragment;
-import com.google.android.gms.maps.model.MarkerOptions;
-
-public class MapFragment extends Fragment {
-
- private SupportMapFragment fragment;
- private FragmentManager fm;
-
- private Project projetCurrent;
-
- View rootView;
- GoogleMap googleMap;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- System.out.println("Load Google Map Fragment");
-
- rootView = inflater.inflate(R.layout.activity_maps, container, false);
-
- fragment = new SupportMapFragment();
-
- fm = getFragmentManager();
-
- FragmentTransaction ft = fm.beginTransaction();
- ft.replace(R.id.mapView, fragment, "mapid").commit();
-
- Bundle bundle = this.getArguments();
- if (bundle != null) {
- String idProject = bundle.getString("idProject");
- Cache<Project> projet = new Project().getCache(idProject)
- .forceRetrieve();
- projet.toResource(new HoldToDo<Project>() {
- @Override
- public void hold(Project project) {
- projetCurrent = project;
- final Handler handler = new Handler();
- handler.postDelayed(new Runnable() {
-
- @Override
- public void run() {
-
- Fragment fr = fm.findFragmentByTag("mapid");
-
- if (fr == null) {
- getActivity().finish();
- }
-
- if (fr instanceof SupportMapFragment) {
- handler.removeCallbacksAndMessages(null);
- googleMap = ((SupportMapFragment) fr).getMap();
- } else {
- handler.removeCallbacksAndMessages(null);
- }
-
- if (googleMap != null) {
- displayInfo();
- handler.removeCallbacksAndMessages(null);
-
- }
-
- else {
- handler.postDelayed(this, 500);
- }
- }
- }, 500);
-
- }
- });
- }
-
- return rootView;
- }
-
- public void displayInfo() {
- MarkerOptions marker = new MarkerOptions();
- marker.position(projetCurrent.getPosition());
- marker.snippet(projetCurrent.getDescription());
- googleMap.addMarker(marker);
-
- CameraUpdate center = CameraUpdateFactory.newLatLng(projetCurrent
- .getPosition());
- CameraUpdate zoom = CameraUpdateFactory.zoomTo(9);
- googleMap.moveCamera(center);
- googleMap.animateCamera(zoom);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
-
-public class PagerAdaptor extends FragmentStatePagerAdapter {
-
- private String idProject;
-
- private String[] titles = { "Commentaires", "Détail du projet", "Emplacement du projet"};
-
- public PagerAdaptor(FragmentManager fm, String idProject) {
- super(fm);
- this.idProject = idProject;
- }
-
- final int PAGE_COUNT = 3;
-
- @Override
- public int getCount() {
- return PAGE_COUNT;
- }
-
- @Override
- public Fragment getItem(int position) {
-
- Fragment fragment = null;
- Bundle bundle = new Bundle();
-
- switch (position) {
-
- case 0:
- fragment = new ListCommentsFragment();
- bundle.putString("idProject",idProject);
- fragment.setArguments(bundle);
- return fragment;
- case 1:
- fragment = new InfoProjectFragment();
- bundle.putString("idProject",idProject);
- fragment.setArguments(bundle);
- return fragment;
- case 2:
- fragment = new MapFragment();
- bundle.putString("idProject",idProject);
- fragment.setArguments(bundle);
- return fragment;
-
- default:
- return new InfoProjectFragment();
- }
- }
-
-
- @Override
- public CharSequence getPageTitle(int position) {
- return titles[position % PAGE_COUNT];
- }
-
-}
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.fragment.v4.participate.PaypalActivity;
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnKeyListener;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-
-public class ParticipatePopup extends Fragment {
-
- private EditText somme;
- private CheckBox conditions;
- private Button valider;
-
- private String idProject;
-
- private Animation shake;
-
- private Fragment _this;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
- View view = inflater.inflate(R.layout.popup_participate, container,
- false);
-
- _this = this;
-
- somme = (EditText) view.findViewById(R.id.participation);
- conditions = (CheckBox) view.findViewById(R.id.conditions);
- valider = (Button) view.findViewById(R.id.valider);
-
- shake = AnimationUtils.loadAnimation(this.getActivity()
- .getBaseContext(), R.anim.shake);
-
- valider.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- if (!conditions.isChecked()) {
- conditions.setTextColor(Color.parseColor("#ff0000"));
- // conditions.invalidate();
- return;
- }
-
- int sommeToFund = 0;
- try {
- sommeToFund = Integer.parseInt(somme.getText().toString());
- } catch (Exception e) {
- somme.startAnimation(shake);
- return;
- }
- if (sommeToFund < 1) {
- somme.startAnimation(shake);
- }
-
- Intent intent = new Intent(getActivity(), PaypalActivity.class);
- intent.putExtra("participation", sommeToFund);
- getActivity().startActivity(intent);
- }
-
- });
-
- view.setFocusableInTouchMode(true);
- view.requestFocus();
- view.setOnKeyListener(new OnKeyListener() {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
-
- FragmentTransaction ft = getActivity()
- .getSupportFragmentManager().beginTransaction();
- ft.setCustomAnimations(R.anim.no_anim, R.anim.popup_exit);
- ft.remove(_this);
- ft.commit();
-
- // Multi Thread pour que l'animation s'éxécute
-
- new Handler().postDelayed(new Runnable() {
- public void run() {
- try {
- getActivity().getWindow().getDecorView()
- .findViewById(R.id.filter)
- .setVisibility(View.GONE);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }, 500);
-
- return true;
- }
- return false;
- }
- });
- return view;
-
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.detailProject;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Bookmark;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.local.utilities.CanI;
-import adullact.publicrowdfunding.model.server.event.CreateEvent;
-import adullact.publicrowdfunding.model.server.event.DeleteEvent;
-import android.graphics.Color;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v4.view.ViewPager;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnKeyListener;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-public class ProjectPagerFragment extends Fragment {
-
- FragmentTransaction fragMentTra;
- FragmentManager fm;
- private String idProject;
-
- private MenuItem star;
-
- private boolean m_Is_favorite;
-
- private Project projectCurrent;
-
- private adullact.publicrowdfunding.MainActivity context;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- View view = inflater.inflate(R.layout.pager_tab, container, false);
-
- Bundle bundle = this.getArguments();
- idProject = bundle.getString("idProject");
-
- context = (adullact.publicrowdfunding.MainActivity) getActivity();
-
- fm = context.getSupportFragmentManager();
- fm.beginTransaction().disallowAddToBackStack().commit();
-
- PagerAdaptor adaptor = new PagerAdaptor(fm, idProject);
-
- ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager);
- viewPager.setAdapter(adaptor);
- viewPager.setCurrentItem(1);
-
- view.setFocusableInTouchMode(true);
- view.requestFocus();
- view.setOnKeyListener(new OnKeyListener() {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- fm.popBackStack();
-
- return true;
- }
- return false;
- }
- });
- return view;
-
- }
-
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- try {
- menu.clear(); // Permettra d'éviter les bugs de superpositions
- } catch (Exception e) {
- e.printStackTrace();
- }
- inflater.inflate(R.menu.detail_projet, menu);
- super.onCreateOptionsMenu(menu, inflater);
- }
-
- @Override
- public void onPrepareOptionsMenu(Menu menu) {
- star = menu.findItem(R.id.add_favorite);
- initBookmark();
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- switch (item.getItemId()) {
-
- case R.id.add_favorite:
- setBookmark();
- break;
- default:
- return super.onOptionsItemSelected(item);
- }
- return true;
-
- }
-
- public void setBookmark() {
-
- try {
- Account account = Account.getOwn();
- account.getUser(new HoldToDo<User>() {
-
- @Override
- public void hold(User resource) {
-
- if (m_Is_favorite) {
- resource.removeBookmark(projectCurrent,
- new DeleteEvent<Bookmark>() {
-
- @Override
- public void errorResourceIdDoesNotExist() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- @Override
- public void onDelete(Bookmark resource) {
- m_Is_favorite = false;
- Toast.makeText(context,
- "Projet retiré de vos favoris",
- Toast.LENGTH_SHORT).show();
- changeColorStar();
- }
-
- @Override
- public void errorAdministratorRequired() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- @Override
- public void errorAuthenticationRequired() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- @Override
- public void errorNetwork() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- });
- } else {
-
- resource.addBookmark(projectCurrent,
- new CreateEvent<Bookmark>() {
-
- @Override
- public void errorResourceIdAlreadyUsed() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- @Override
- public void onCreate(Bookmark resource) {
- m_Is_favorite = true;
- Toast.makeText(context,
- "Projet ajouté à vos favoris",
- Toast.LENGTH_SHORT).show();
- changeColorStar();
- }
-
- @Override
- public void errorAuthenticationRequired() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- @Override
- public void errorNetwork() {
- Toast.makeText(context,
- "Une erreur s'est produite",
- Toast.LENGTH_SHORT).show();
-
- }
-
- });
- }
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- Toast.makeText(context,
- "Il faut un compte pour avoir des favoris !",
- Toast.LENGTH_SHORT).show();
- e.printStackTrace();
- }
- }
-
- public void initBookmark() {
-
- new Project().getCache(idProject).forceRetrieve()
- .toResource(new HoldToDo<Project>() {
-
- @Override
- public void hold(Project resource) {
- projectCurrent = resource;
- function();
-
- }
-
- });
-
- }
-
- public void function() {
- try {
- Account.getOwn();
- new CanI() {
- @Override
- protected void yes() {
- m_Is_favorite = false;
- }
-
- @Override
- protected void no() {
- m_Is_favorite = true;
- }
-
- }.bookmark(projectCurrent);
-
- } catch (NoAccountExistsInLocal e) {
- m_Is_favorite = false;
- }
- changeColorStar();
- }
-
- public void changeColorStar() {
- PorterDuffColorFilter filter;
- if (m_Is_favorite) {
-
- filter = new PorterDuffColorFilter(Color.YELLOW,
- PorterDuff.Mode.SRC_ATOP);
-
- } else {
-
- filter = new PorterDuffColorFilter(Color.TRANSPARENT,
- PorterDuff.Mode.SRC_ATOP);
- }
- star.getIcon().setColorFilter(filter);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.participate;
-
-import java.math.BigDecimal;
-
-import org.json.JSONException;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.widget.Toast;
-
-import com.paypal.android.sdk.payments.PayPalAuthorization;
-import com.paypal.android.sdk.payments.PayPalConfiguration;
-import com.paypal.android.sdk.payments.PayPalFuturePaymentActivity;
-import com.paypal.android.sdk.payments.PayPalPayment;
-import com.paypal.android.sdk.payments.PayPalService;
-import com.paypal.android.sdk.payments.PaymentActivity;
-import com.paypal.android.sdk.payments.PaymentConfirmation;
-
-public class PaypalActivity extends Activity {
-
- private int participation;
-
- private static final String TAG = "paymentExample";
-
- private static final String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_NO_NETWORK;
- private static final String CONFIG_CLIENT_ID = "";
- private static final int REQUEST_CODE_PAYMENT = 5;
- private static final int REQUEST_CODE_FUTURE_PAYMENT = 6;
-
- private static PayPalConfiguration config = new PayPalConfiguration()
- .environment(CONFIG_ENVIRONMENT).clientId(CONFIG_CLIENT_ID)
- .merchantName("PublicrowdFunding Store")
- .merchantPrivacyPolicyUri(Uri.parse(""))
- .merchantUserAgreementUri(Uri.parse(""));
-
- public void configurationPaypal() {
- Intent intent = new Intent(this, PayPalService.class);
- intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
- startService(intent);
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- configurationPaypal();
-
- participation = getIntent().getExtras().getInt("participation", 0);
- if (participation == 0) {
- Toast.makeText(getApplicationContext(),
- "Une Erreur s'est produite", Toast.LENGTH_SHORT).show();
- finish();
- }
-
- /* Paypal */
-
- PayPalPayment thingToBuy = getSommeParticipations(PayPalPayment.PAYMENT_INTENT_SALE);
- Intent intent = new Intent(PaypalActivity.this,
- PaymentActivity.class);
- intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
- startActivityForResult(intent, REQUEST_CODE_PAYMENT);
-
- }
-
- private PayPalPayment getSommeParticipations(String paymentIntent) {
- return new PayPalPayment(new BigDecimal(participation), "EUR",
- "Participer au projet", paymentIntent);
- }
-
- public void onFuturePaymentPressed(View pressed) {
- Intent intent = new Intent(PaypalActivity.this,
- PayPalFuturePaymentActivity.class);
-
- startActivityForResult(intent, REQUEST_CODE_FUTURE_PAYMENT);
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- System.out.println("Result : "+requestCode);
- if (requestCode == REQUEST_CODE_PAYMENT) {
- if (resultCode == Activity.RESULT_OK) {
- PaymentConfirmation confirm = data
- .getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
- if (confirm != null) {
- try {
- Log.i(TAG, confirm.toJSONObject().toString(4));
- Log.i(TAG, confirm.getPayment().toJSONObject()
- .toString(4));
- /**
- * TODO: send 'confirm' (and possibly
- * confirm.getPayment() to your server for verification
- * or consent completion. See
- * https://developer.paypal.com
- * /webapps/developer/docs/integration
- * /mobile/verify-mobile-payment/ for more details.
- *
- * For sample mobile backend interactions, see
- * https://github
- * .com/paypal/rest-api-sdk-python/tree/master
- * /samples/mobile_backend
- */
-
- System.out.println("Tout est ok");
-
- Intent returnIntent = new Intent();
- setResult(RESULT_OK,returnIntent);
- finish();
-
- } catch (JSONException e) {
- System.out.println("JSON error 2");
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- }
- }
- } else if (resultCode == Activity.RESULT_CANCELED) {
- System.out.println("annulation");
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
- System.out.println("Extra invalid 2");
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- }
-
- } else if (requestCode == REQUEST_CODE_FUTURE_PAYMENT) {
- if (resultCode == Activity.RESULT_OK) {
- PayPalAuthorization auth = data
- .getParcelableExtra(PayPalFuturePaymentActivity.EXTRA_RESULT_AUTHORIZATION);
- if (auth != null) {
- try {
- Log.i("FuturePaymentExample", auth.toJSONObject()
- .toString(4));
-
- String authorization_code = auth.getAuthorizationCode();
- Log.i("FuturePaymentExample", authorization_code);
-
- sendAuthorizationToServer(auth);
- Toast.makeText(getApplicationContext(),
- "Future Payment code received from PayPal",
- Toast.LENGTH_LONG).show();
-
- } catch (JSONException e) {
- System.out.println("JSON Exception");
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- }
- }
- } else if (resultCode == Activity.RESULT_CANCELED) {
- System.out.println("canceled");
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- } else if (resultCode == PayPalFuturePaymentActivity.RESULT_EXTRAS_INVALID) {
- System.out.println("Extra invalid");
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- }
- }
- }
-
- private void sendAuthorizationToServer(PayPalAuthorization authorization) {
-
- /**
- * TODO: Send the authorization response to your server, where it can
- * exchange the authorization code for OAuth access and refresh tokens.
- *
- * Your server must then store these tokens, so that your server code
- * can execute payments for this user in the future.
- *
- * A more complete example that includes the required app-server to
- * PayPal-server integration is available from
- * https://github.com/paypal/
- * rest-api-sdk-python/tree/master/samples/mobile_backend
- */
-
- }
-
- public void onFuturePaymentPurchasePressed(View pressed) {
- // Get the Application Correlation ID from the SDK
- String correlationId = PayPalConfiguration
- .getApplicationCorrelationId(this);
-
- Log.i("FuturePaymentExample", "Application Correlation ID: "
- + correlationId);
-
- Toast.makeText(getApplicationContext(),
- "App Correlation ID received from SDK", Toast.LENGTH_LONG)
- .show();
- }
-
- @Override
- public void onDestroy() {
- // Stop service when done
- stopService(new Intent(this, PayPalService.class));
- super.onDestroy();
- }
-
-}
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.profile;
-
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.custom.ProjectAdaptor;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class ListBookmarksFragment extends Fragment {
-
- private ListView listeProjets;
-
- private ArrayList<Project> projets;
-
- private ArrayAdapter<Project> adapter;
-
- private View view;
-
- private TextView empty;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
- view = inflater.inflate(R.layout.fragment_list_project_no_refresh,
- container, false);
-
- listeProjets = (ListView) view.findViewById(R.id.liste);
-
- empty = (TextView) view.findViewById(R.id.empty);
- listeProjets.setEmptyView(empty);
-
- projets = new ArrayList<Project>();
-
- adapter = new ProjectAdaptor(this.getActivity().getBaseContext(),
- R.layout.adaptor_project, projets);
- listeProjets.setAdapter(adapter);
-
- // refresh();
-
- listeProjets.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter_2, R.anim.exit);
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.ProjectPagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", projets.get(position).getResourceId());
- fragment.setArguments(bundle);
- fragment.setHasOptionsMenu(true);
- ft.replace(R.id.content_frame, fragment);
- ft.commit();
- }
- });
-
- Bundle bundle = this.getArguments();
- String idUser = bundle.getString("idUser");
- if (idUser.equals("me")) {
- try {
- Account.getOwn().getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- resource.getBookmarkedProjects(new WhatToDo<Project>() {
-
- @Override
- public void hold(Project resource) {
- projets.add(resource);
- adapter.notifyDataSetChanged();
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- } else {
- Cache<User> cache = new User().getCache(idUser);
- cache.toResource(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- resource.getBookmarkedProjects(new WhatToDo<Project>() {
-
- @Override
- public void hold(Project resource) {
- projets.add(resource);
- adapter.notifyDataSetChanged();
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
- });
-
- }
-
- return view;
- }
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.profile;
-
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.custom.ProjectAdaptor;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.cache.Cache;
-import adullact.publicrowdfunding.model.local.callback.WhatToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class ListFinancedProjectsFragment extends Fragment {
-
- private ListView listeProjets;
-
- private ArrayList<Project> projets;
-
- private ArrayAdapter<Project> adapter;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- final View view = inflater.inflate(
- R.layout.fragment_list_project_no_refresh, container, false);
-
- listeProjets = (ListView) view.findViewById(R.id.liste);
-
- TextView empty = (TextView) view.findViewById(R.id.empty);
- listeProjets.setEmptyView(empty);
-
- projets = new ArrayList<Project>();
-
- adapter = new ProjectAdaptor(this.getActivity().getBaseContext(),
- R.layout.adaptor_project, projets);
-
- listeProjets.setAdapter(adapter);
-
- listeProjets.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter_2, R.anim.exit);
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.ProjectPagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", projets.get(position).getResourceId());
- fragment.setArguments(bundle);
- fragment.setHasOptionsMenu(true);
- ft.replace(R.id.content_frame, fragment);
- ft.commit();
- }
- });
-
-
-
- Bundle bundle = this.getArguments();
- String idUser = bundle.getString("idUser");
- if (idUser.equals("me")) {
- try {
- Account.getOwn().getUser(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- resource.getFundedProjects(new WhatToDo<Project>() {
-
- @Override
- public void hold(Project resource) {
- projets.add(resource);
- adapter.notifyDataSetChanged();
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
-
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- } catch (NoAccountExistsInLocal e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- } else {
- Cache<User> cache = new User().getCache(idUser);
- cache.toResource(new WhatToDo<User>() {
-
- @Override
- public void hold(User resource) {
- resource.getFundedProjects(new WhatToDo<Project>() {
-
- @Override
- public void hold(Project resource) {
- projets.add(resource);
- adapter.notifyDataSetChanged();
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
-
- });
- }
-
- @Override
- public void eventually() {
- // TODO Auto-generated method stub
-
- }
- });
-
- }
-
- return view;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.profile;
-
-import java.util.ArrayList;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.custom.ProjectAdaptor;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class ListSubmitedProjectsFragment extends Fragment {
-
- private ListView listeProjets;
-
- private ArrayList<Project> projets;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- final View view = inflater.inflate(R.layout.fragment_list_project_no_refresh, container, false);
-
- listeProjets = (ListView) view.findViewById(R.id.liste);
-
- TextView empty = (TextView) view.findViewById(R.id.empty);
- listeProjets.setEmptyView(empty);
-
- projets = new ArrayList<Project>();
-
- ArrayAdapter<Project> adapter = new ProjectAdaptor(this.getActivity()
- .getBaseContext(), R.layout.adaptor_project, projets);
-
- listeProjets.setAdapter(adapter);
- listeProjets.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
-
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter_2, R.anim.exit);
- Fragment fragment = new adullact.publicrowdfunding.fragment.v4.detailProject.ProjectPagerFragment();
- Bundle bundle = new Bundle();
- bundle.putString("idProject", projets.get(position).getResourceId());
- fragment.setArguments(bundle);
- fragment.setHasOptionsMenu(true);
- ft.replace(R.id.content_frame, fragment);
- ft.commit();
- }
- });
-
- return view;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.profile;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
-
-public class PagerAdaptor extends FragmentStatePagerAdapter {
-
- private String idUser;
-
- private String[] titles = { "Projets soumis", "Favoris", "Fianncé"};
-
- public PagerAdaptor(FragmentManager fm, String idUser) {
- super(fm);
- this.idUser = idUser;
- }
-
- final int PAGE_COUNT = 3;
-
- @Override
- public int getCount() {
- return PAGE_COUNT;
- }
-
- @Override
- public Fragment getItem(int position) {
-
- Fragment fragment = null;
- Bundle bundle = new Bundle();
-
- switch (position) {
-
- case 0:
- fragment = new ListSubmitedProjectsFragment();
- bundle.putString("idUser",idUser);
- fragment.setArguments(bundle);
- return fragment;
- case 1:
- fragment = new ListBookmarksFragment();
- bundle.putString("idUser",idUser);
- fragment.setArguments(bundle);
- return fragment;
- case 2:
- fragment = new ListFinancedProjectsFragment();
- bundle.putString("idUser",idUser);
- fragment.setArguments(bundle);
- return fragment;
-
- default:
- return new ListBookmarksFragment();
- }
- }
-
-
- @Override
- public CharSequence getPageTitle(int position) {
- return titles[position % PAGE_COUNT];
- }
-
-}
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.profile;
-
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Project;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import android.app.FragmentTransaction;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.view.ViewPager;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnKeyListener;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class ProfilePagerFragment extends Fragment {
-
- protected Project projetCurrent;
-
- FragmentTransaction fragMentTra = null;
- private String idUser;
- private FragmentManager fm;
-
- private TextView m_pseudo;
- private TextView m_ville;
- private ImageView m_avatar;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
- View view = inflater.inflate(R.layout.pager_tab_profile, container, false);
- ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager);
-
-
- m_pseudo = (TextView) view.findViewById(R.id.pseudo);
- m_ville = (TextView) view.findViewById(R.id.ville);
-
- m_avatar = (ImageView) view.findViewById(R.id.avatar);
-
- Bundle bundle = this.getArguments();
- idUser = bundle.getString("idUser");
-
-
- new User().getCache(idUser).forceRetrieve().toResource(new HoldToDo<User>(){
-
- @Override
- public void hold(User resource) {
- m_pseudo.setText(resource.getPseudo());
- m_ville.setText(resource.getCity());
- if (resource.getGender().equals("0")) {
- m_avatar.setImageResource(R.drawable.male_user_icon);
- } else {
- m_avatar.setImageResource(R.drawable.female_user_icon);
- }
- }
-
- });
-
-
- adullact.publicrowdfunding.MainActivity _this = (adullact.publicrowdfunding.MainActivity) getActivity();
-
- fm = _this.getSupportFragmentManager();
- fm.beginTransaction().disallowAddToBackStack().commit();
-
- PagerAdaptor adaptor = new PagerAdaptor(fm, idUser);
- viewPager.setAdapter(adaptor);
- viewPager.setCurrentItem(1);
-
- view.setFocusableInTouchMode(true);
- view.requestFocus();
- view.setOnKeyListener(new OnKeyListener() {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- fm.popBackStack();
-
- return true;
- }
- return false;
- }
- });
- return view;
-
- }
-
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.register;
-
-import adullact.publicrowdfunding.MainActivity;
-import adullact.publicrowdfunding.ListProjectsFragment;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
-import adullact.publicrowdfunding.model.local.callback.HoldToDo;
-import adullact.publicrowdfunding.model.local.ressource.Account;
-import adullact.publicrowdfunding.model.local.ressource.User;
-import adullact.publicrowdfunding.model.server.event.AuthenticationEvent;
-import adullact.publicrowdfunding.model.server.request.AuthenticationRequest;
-import android.content.Context;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Toast;
-
-public class ConnexionFragment extends Fragment {
-
- private EditText m_login;
- private EditText m_password;
- private Button m_buttonValider;
- private Button m_buttonInscription;
- private Context context;
-
- private LinearLayout loading;
- private LinearLayout loadingPersonnelInfo;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- final View view = inflater.inflate(R.layout.activity_authetificate,
- container, false);
-
- context = getActivity();
-
- m_login = (EditText) view.findViewById(R.id.login_connexion);
- m_password = (EditText) view.findViewById(R.id.password_connexion);
-
- m_buttonValider = (Button) view.findViewById(R.id.valider_connexion);
- m_buttonInscription = (Button) view.findViewById(R.id.inscription_button);
-
- loading = (LinearLayout) view.findViewById(R.id.loading);
- loading.setVisibility(View.GONE);
-
- loadingPersonnelInfo = (LinearLayout) view.findViewById(R.id.loadingLoadingInfo);
- loadingPersonnelInfo.setVisibility(View.GONE);
-
- m_buttonValider.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
-
- if (m_login.length() == 0) {
- Toast.makeText(context, "Vous avez oublié le login",
- Toast.LENGTH_SHORT).show();
- return;
- }
-
- if (m_password.length() == 0) {
-
- Toast.makeText(context, "Vous avez oublié le mot de passe",
- Toast.LENGTH_SHORT).show();
- return;
- }
-
-
- loading.setVisibility(View.VISIBLE);
- String login = m_login.getText().toString();
- String password = m_password.getText().toString();
-
- new AuthenticationRequest(login, password,
- new AuthenticationEvent() {
- @Override
- public void errorUsernamePasswordDoesNotMatch(
- String username, String password) {
- System.out
- .println("Login ou mot de passe incorect");
- Toast.makeText(context,
- "Login ou mot de passe incorect",
- Toast.LENGTH_LONG).show();
- loading.setVisibility(View.GONE);
- }
-
- @Override
- public void onAuthentication() {
- try {
- loading.setVisibility(View.GONE);
- loadingPersonnelInfo.setVisibility(View.VISIBLE);
- Account.getOwn().getUser(new HoldToDo<User>() {
- @Override
- public void hold(User resource) {
- Toast.makeText(context, "Bienvenue " + resource.getPseudo(), Toast.LENGTH_LONG).show();
-
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new ListProjectsFragment();
-
- ft.replace(R.id.content_frame, fragment, "allProjectFragment");
-
- MainActivity _this = (MainActivity) getActivity();
- _this.isConnect();
-
- ft.commit();
-
-
- }
- });
- } catch (NoAccountExistsInLocal noAccountExistsInLocal) {
- Toast.makeText(context, "Impossible de se conncecté", Toast.LENGTH_LONG).show();
-
- }
- }
-
- @Override
- public void errorNetwork() {
- System.out.println("Erreur serveur");
- Toast.makeText(
- context,
- "Connexion impossible au serveur, veuillez vérifier vos paramètres resaux.",
- Toast.LENGTH_LONG).show();
- loading.setVisibility(View.GONE);
- }
- }).execute();
- }
- });
-
- m_buttonInscription.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
-
-
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new RegisterFragement();
-
- ft.replace(R.id.content_frame, fragment);
-
- String login = m_login.getText().toString();
- Bundle bundle = new Bundle();
- bundle.putString("login", login);
- fragment.setArguments(bundle);
-
- MainActivity _this = (MainActivity) getActivity();
- _this.isConnect();
-
- ft.commit();
-
- }
- });
- return view;
- }
-
- @Override
- public void onPrepareOptionsMenu(Menu menu) {
- menu.findItem(R.id.action_search).setVisible(false);
- menu.findItem(R.id.action_sort).setVisible(false);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package adullact.publicrowdfunding.fragment.v4.register;
-
-import adullact.publicrowdfunding.MainActivity;
-import adullact.publicrowdfunding.ListProjectsFragment;
-import adullact.publicrowdfunding.R;
-import adullact.publicrowdfunding.model.server.event.RegistrationEvent;
-import adullact.publicrowdfunding.model.server.request.RegistrationRequest;
-import android.content.Context;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.View;
-import android.view.View.OnKeyListener;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Toast;
-
-public class RegisterFragement extends Fragment {
-
- private EditText m_login;
- private EditText m_password1;
- private EditText m_password2;
- private Button m_button;
-
- private LinearLayout loading;
-
- private Context context;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- final View view = inflater.inflate(R.layout.activity_register,
- container, false);
-
- context = getActivity();
-
- m_login = (EditText) view.findViewById(R.id.inscription_login);
- m_password1 = (EditText) view.findViewById(R.id.inscription_password1);
- m_password2 = (EditText) view.findViewById(R.id.inscription_password2);
- m_button = (Button) view.findViewById(R.id.inscription_button);
-
- loading = (LinearLayout) view.findViewById(R.id.loading);
- loading.setVisibility(View.GONE);
-
-
- Bundle bundle = this.getArguments();
- if(bundle != null){
- String login = bundle.getString("login");
- m_login.setText(login);
- }
-
- m_button.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
-
- if (m_login.length() == 0) {
- Toast.makeText(context,
- "Vous avez oublié le pseudo", Toast.LENGTH_SHORT)
- .show();
- return;
- }
-
- if (m_password1.length() == 0) {
- Toast.makeText(context,
- "Vous avez oublié le 1er mot de passes",
- Toast.LENGTH_SHORT).show();
- return;
- }
-
- if (m_password2.length() == 0) {
- Toast.makeText(context,
- "Vous avez oublié le 2e mot de passes",
- Toast.LENGTH_SHORT).show();
- return;
- }
-
- if (!m_password1.getText().toString()
- .equals(m_password2.getText().toString())) {
- Toast.makeText(context,
- "Les mots de passe sont différents : ",
- Toast.LENGTH_SHORT).show();
- return;
- }
-
- loading.setVisibility(View.VISIBLE);
-
- String username = m_login.getText().toString();
- String password = m_password1.getText().toString();
-
-
- // Je differencie compte (username + password) et user
- // maintenant, je te divise ta requête
-
- new RegistrationRequest(username, password, username, new RegistrationEvent() {
- @Override
- public void onRegister() {
- Toast.makeText(context, "Bienvenue "+m_login.getText().toString(), Toast.LENGTH_SHORT).show();
-
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new ListProjectsFragment();
-
- ft.replace(R.id.content_frame, fragment);
-
- MainActivity _this = (MainActivity) getActivity();
- _this.isConnect();
-
- ft.commit();
- }
-
- @Override
- public void errorUsernameAlreadyUsed() {
- loading.setVisibility(View.GONE);
- Toast.makeText(context, "Username déjà pris", Toast.LENGTH_SHORT).show();
- }
-
- @Override
- public void errorPseudoAlreadyUsed() {
- loading.setVisibility(View.GONE);
- Toast.makeText(context, "Username déjà pris", Toast.LENGTH_SHORT).show();
- }
-
- @Override
- public void errorNetwork() {
- loading.setVisibility(View.GONE);
- Toast.makeText(context, "Probléme de connection", Toast.LENGTH_SHORT).show();
- }
- }).execute();
- }
- });
-
- view.setFocusableInTouchMode(true);
- view.requestFocus();
- view.setOnKeyListener( new OnKeyListener()
- {
- @Override
- public boolean onKey( View v, int keyCode, KeyEvent event )
- {
- if( keyCode == KeyEvent.KEYCODE_BACK )
- {
- System.out.println("back");
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- //ft.setCustomAnimations(R.anim.enter, R.anim.exit);
- Fragment fragment = new ConnexionFragment();
- ft.replace(R.id.content_frame, fragment);
-
- ft.commit();
- return true;
- }
- return false;
- }
- } );
-
- return view;
-
- }
-
- @Override
- public void onPrepareOptionsMenu(Menu menu) {
- menu.findItem(R.id.action_search).setVisible(false);
- menu.findItem(R.id.action_sort).setVisible(false);
- }
-
-
-
-}
\ No newline at end of file
package adullact.publicrowdfunding.model.local.cache;
-import java.util.ArrayList;
-import java.util.Comparator;
-
import org.joda.time.DateTime;
import org.joda.time.Duration;
+import java.util.ArrayList;
+import java.util.Comparator;
+
import adullact.publicrowdfunding.model.local.callback.WhatToDo;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.event.RetrieveEvent;
package adullact.publicrowdfunding.model.local.callback;
+import adullact.publicrowdfunding.model.local.cache.Sync;
+import adullact.publicrowdfunding.model.local.ressource.Resource;
import rx.Scheduler;
import rx.functions.Action0;
import rx.schedulers.Schedulers;
-import adullact.publicrowdfunding.model.local.cache.Sync;
-import adullact.publicrowdfunding.model.local.ressource.Resource;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.local.database;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+
import java.util.ArrayList;
import adullact.publicrowdfunding.model.local.ressource.Project;
import adullact.publicrowdfunding.model.local.utilities.Utility;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.local.database;
-import adullact.publicrowdfunding.PublicrowdFundingApplication;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
+import adullact.publicrowdfunding.PublicrowdFundingApplication;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.model.local.ressource;
-import java.security.SecureRandom;
+import android.content.SharedPreferences;
+
import java.util.ArrayList;
import java.util.Map;
-import javax.crypto.Cipher;
-import javax.crypto.KeyGenerator;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-
-import rx.Observable;
import adullact.publicrowdfunding.PublicrowdFundingApplication;
import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
import adullact.publicrowdfunding.model.local.cache.Cache;
import adullact.publicrowdfunding.model.server.entities.ServerAccount;
import adullact.publicrowdfunding.model.server.entities.Service;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
-import android.content.SharedPreferences;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
}
m_username = sharedPreferences.getString(KEY_USERNAME, "");
- m_password = decrypt("mystery", sharedPreferences.getString(KEY_PASSWORD, ""));
+ m_password = sharedPreferences.getString(KEY_PASSWORD, "");
m_administrator = sharedPreferences.getBoolean(KEY_ADMIN, false);
User user = new User();
});
new Cache<Account>(own).declareUpToDate().useIt();
}
-
-
-
-
private void save() {
SharedPreferences.Editor editor = PublicrowdFundingApplication.sharedPreferences().edit();
editor.putString(KEY_USERNAME, m_username);
- editor.putString(KEY_PASSWORD, encrypt("mystery", m_password));
+ editor.putString(KEY_PASSWORD, m_password);
editor.putString(KEY_PSEUDO, m_user.getResourceId());
editor.putBoolean(KEY_ADMIN, m_administrator);
editor.apply();
}
-
-
- /* --------- Cryptography part ------------ */
- private final static String HEX = "0123456789ABCDEF";
- private static String encrypt(String seed, String password) {
- byte[] result;
- try {
- byte[] rawKey = getRawKey(seed.getBytes());
- result = encrypt(rawKey, password.getBytes());
- }
- catch(Exception exception) {
- return password;
- }
- return toHex(result);
- }
-
- private static String decrypt(String seed, String encrypted) {
- byte[] result;
- try {
- byte[] rawKey = getRawKey(seed.getBytes());
- byte[] enc = toByte(encrypted);
- result = decrypt(rawKey, enc);
- }
- catch(Exception exception) {
- return encrypted;
- }
- return new String(result);
- }
-
- private static byte[] getRawKey(byte[] seed) throws Exception {
- KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
- SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
- sr.setSeed(seed);
- keyGenerator.init(128, sr); // 192 and 256 bits may not be available
- SecretKey secretKey = keyGenerator.generateKey();
- byte[] raw = secretKey.getEncoded();
- return raw;
- }
-
-
- private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception {
- SecretKeySpec secretKeySpec = new SecretKeySpec(raw, "AES");
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
- byte[] encrypted = cipher.doFinal(clear);
- return encrypted;
- }
-
- private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception {
- SecretKeySpec secretKeySpec = new SecretKeySpec(raw, "AES");
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
- byte[] decrypted = cipher.doFinal(encrypted);
- return decrypted;
- }
-
- private static byte[] toByte(String hexString) {
- int len = hexString.length()/2;
- byte[] result = new byte[len];
- for (int i = 0; i < len; i++)
- result[i] = Integer.valueOf(hexString.substring(2*i, 2*i+2), 16).byteValue();
- return result;
- }
-
- private static String toHex(byte[] buf) {
- if (buf == null)
- return "";
- StringBuffer result = new StringBuffer(2*buf.length);
- for (int i = 0; i < buf.length; i++) {
- appendHex(result, buf[i]);
- }
- return result.toString();
- }
-
- private static void appendHex(StringBuffer sb, byte b) {
- sb.append(HEX.charAt((b>>4)&0x0f)).append(HEX.charAt(b&0x0f));
- }
- /* ---------------------------------------- */
}
package adullact.publicrowdfunding.model.local.ressource;
+import org.joda.time.DateTime;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import org.joda.time.DateTime;
-
-import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.Cache;
import adullact.publicrowdfunding.model.local.callback.WhatToDo;
import adullact.publicrowdfunding.model.local.utilities.Utility;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.event.ListerEvent;
import adullact.publicrowdfunding.model.server.request.ListerRequest;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.local.ressource;
+import org.joda.time.DateTime;
+
import java.util.ArrayList;
import java.util.Map;
-import org.joda.time.DateTime;
-
-import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.Cache;
import adullact.publicrowdfunding.model.local.callback.WhatToDo;
import adullact.publicrowdfunding.model.local.utilities.Utility;
import adullact.publicrowdfunding.model.server.entities.ServerCommentary;
import adullact.publicrowdfunding.model.server.entities.Service;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.local.ressource;
+import org.joda.time.DateTime;
+
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import org.joda.time.DateTime;
-
-import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.Cache;
import adullact.publicrowdfunding.model.local.callback.WhatToDo;
import adullact.publicrowdfunding.model.local.utilities.Utility;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.event.ListerEvent;
import adullact.publicrowdfunding.model.server.request.ListerRequest;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.local.ressource;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
+import com.google.android.gms.maps.model.LatLng;
import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
import org.joda.time.Duration;
import org.joda.time.Interval;
-import rx.Observable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
import adullact.publicrowdfunding.model.local.cache.Cache;
import adullact.publicrowdfunding.model.local.cache.CacheSet;
import adullact.publicrowdfunding.model.server.event.CreateEvent;
import adullact.publicrowdfunding.model.server.event.ListerEvent;
import adullact.publicrowdfunding.model.server.request.ListerRequest;
-
-import com.google.android.gms.maps.model.LatLng;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
this.m_active = false;
}
- public Project(String name, String description, String proposedBy, String requestedFunding, DateTime beginDate, DateTime endDate, LatLng position, int illustration, String email, String website, String phone, boolean validate) {
+ public Project(String name, String description, String proposedBy, String requestedFunding, DateTime endDate, LatLng position, int illustration, String email, String website, String phone, boolean validate) {
this.m_id = null;
this.m_name = name;
this.m_description = description;
this.m_proposedBy = new User().getCache(proposedBy);
this.m_requestedFunding = new BigDecimal(requestedFunding);
this.m_currentFunding = new BigDecimal("0");
- this.m_creationDate = DateTime.now();
- this.m_fundingInterval = new Interval(beginDate, endDate);
+ this.m_creationDate = DateTime.now(DateTimeZone.getDefault());
this.m_fundingIntervals = new ArrayList<FundingInterval>();
+ if(validate) {
+ this.m_fundingInterval = new Interval(DateTime.now(DateTimeZone.getDefault()), endDate);
+ calculatePeriods();
+ }
+ else {
+ this.m_fundingInterval = new Interval(endDate, endDate);
+ }
this.m_position = position;
this.m_validate = validate;
this.m_illustration = illustration;
this.m_email = email;
this.m_website = website;
this.m_phone = phone;
-
- // Now, we calculate 10 periods for graphics
- calculatePeriods();
}
/**
this.m_email = email;
this.m_website = website;
this.m_phone = phone;
-
- // Now, we calculate 10 periods for graphics
- calculatePeriods();
}
int numberOfPeriod = 10;
DateTime startDateTime = m_fundingInterval.getStart();
long numberOfDayBetweenStartAndEnd = m_fundingInterval.toDuration().getStandardDays();
- long dayByPeriod = numberOfDayBetweenStartAndEnd/numberOfPeriod;
- DateTime today = new DateTime();
- for(int i = 0; i < (numberOfPeriod-1); i++){
- if(!startDateTime.isBefore(today)){
- return i;
- } else{
- startDateTime = startDateTime.plusDays((int) dayByPeriod);
+ if(numberOfDayBetweenStartAndEnd >= numberOfPeriod) {
+ long dayByPeriod = numberOfDayBetweenStartAndEnd / numberOfPeriod;
+ DateTime today = new DateTime();
+ for (int i = 0; i < (numberOfPeriod - 1); i++) {
+ if (!startDateTime.isBefore(today)) {
+ return i;
+ } else {
+ startDateTime = startDateTime.plusDays((int) dayByPeriod);
+ }
}
}
DateTime startDateTime = m_fundingInterval.getStart();
DateTime endDateTime = m_fundingInterval.getEnd();
long numberOfDayBetweenStartAndEnd = m_fundingInterval.toDuration().getStandardDays();
- long dayByPeriod = numberOfDayBetweenStartAndEnd/numberOfPeriod;
- for(int i = 0; i < (numberOfPeriod-1); i++){
- m_fundingIntervals.add(new FundingInterval(new Interval(startDateTime, startDateTime.plusDays((int) dayByPeriod))));
- startDateTime = startDateTime.plusDays((int) dayByPeriod);
+ if(numberOfDayBetweenStartAndEnd >= numberOfPeriod) {
+ long dayByPeriod = numberOfDayBetweenStartAndEnd/numberOfPeriod;
+ for(int i = 0; i < (numberOfPeriod-1); i++){
+ m_fundingIntervals.add(new FundingInterval(new Interval(startDateTime, startDateTime.plusDays((int) dayByPeriod))));
+ startDateTime = startDateTime.plusDays((int) dayByPeriod);
+ }
+ m_fundingIntervals.add(new FundingInterval(new Interval(startDateTime, endDateTime)));
}
- m_fundingIntervals.add(new FundingInterval(new Interval(startDateTime, endDateTime)));
}
public String getName() {
public void setValidate(boolean validate) {
m_validate = validate;
+
+ if(validate) {
+ m_fundingInterval = new Interval(DateTime.now(DateTimeZone.getDefault()), m_fundingInterval.getEnd());
+ calculatePeriods();
+ }
+ else {
+ m_fundingInterval = new Interval(m_fundingInterval.getEnd(), m_fundingInterval.getEnd());
+ }
}
* @brief Add value to current funding.
*/
public void finance(final String value, final CreateEvent<Funding> fundingCreateEvent) throws NoAccountExistsInLocal {
- Account account = Account.getOwn();
+ final Account account = Account.getOwn();
final Project _this = this;
account.getUser(new HoldToDo<User>() {
@Override
}
@Override
- public void onCreate(Funding resource) {
+ public void onCreate(final Funding funding) {
m_currentFunding = m_currentFunding.add(new BigDecimal(value));
- fundingCreateEvent.onCreate(resource);
-
+ account.getUser(new HoldToDo<User>() {
+ @Override
+ public void hold(User resource) {
+ resource.getFundedProjects().add(funding);
+ fundingCreateEvent.onCreate(funding);
+ }
+ });
}
@Override
public void errorAuthenticationRequired() {
fundingCreateEvent.errorAuthenticationRequired();
-
}
@Override
public void errorNetwork() {
fundingCreateEvent.errorNetwork();
-
}
@Override
fundingCreateEvent.errorServer();
}
+ @Override
+ public void errorAdministratorRequired() {
+ fundingCreateEvent.errorAdministratorRequired();
+ }
});
}
});
public void errorAuthenticationRequired() {
commentaryCreateEvent.errorAuthenticationRequired();
}
+
+ @Override
+ public void errorAdministratorRequired() {
+ commentaryCreateEvent.errorAdministratorRequired();
+ }
});
}
});
import java.util.HashMap;
import java.util.Map;
-import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.Cache;
import adullact.publicrowdfunding.model.server.entities.RowAffected;
import adullact.publicrowdfunding.model.server.entities.Service;
import adullact.publicrowdfunding.model.server.request.ListerRequest;
import adullact.publicrowdfunding.model.server.request.RetrieveRequest;
import adullact.publicrowdfunding.model.server.request.UpdateRequest;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
import java.util.ArrayList;
import java.util.Map;
-import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.CacheSet;
import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
import adullact.publicrowdfunding.model.local.callback.HoldToDo;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.event.CreateEvent;
import adullact.publicrowdfunding.model.server.event.DeleteEvent;
+import rx.Observable;
/**
* @author Ferrand and Nelaupe
this.m_funding = new CacheSet<Funding>();
for(final ServerFunding serverFunding : detailedServerUser.fundedProjects) {
- //m_funding.add(new Funding().makeCopyFromServer(serverFunding).getCache(Integer.toString(serverFunding.id)));
+ m_funding.add(new Funding().makeCopyFromServer(serverFunding).getCache(Integer.toString(serverFunding.id)));
}
return this;
}
public void errorServer() {
bookmarkCreateEvent.errorServer();
}
+
+ @Override
+ public void errorAdministratorRequired() {
+ bookmarkCreateEvent.errorAdministratorRequired();
+ }
});
}
});
}
+ public CacheSet<Funding> getFundedProjects() {
+ return m_funding;
+ }
+
/* Setters */
public void setPseudo(String pseudo) {
m_pseudo = pseudo;
package adullact.publicrowdfunding.model.local.utilities;
+import org.joda.time.Interval;
+
import java.math.BigDecimal;
import java.util.ArrayList;
-import org.joda.time.Interval;
-
import adullact.publicrowdfunding.model.local.ressource.Funding;
/**
import org.joda.time.DateTimeZone;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
-import java.util.TreeSet;
+import java.util.Map;
+import java.util.TreeMap;
import java.util.regex.Pattern;
import adullact.publicrowdfunding.PublicrowdFundingApplication;
/* --- Singleton --- */
private static SyncServerToLocal m_instance = null;
private SyncServerToLocal() {
- this.m_projects = new TreeSet<Project>(new Comparator<Project>() {
- @Override
- public int compare(Project project1, Project project2) {
- return project1.getResourceId().compareTo(project2.getResourceId());
- }
- });
+ this.m_projects = new TreeMap<String, Project>();
ProjectsDatabase projectsDatabase = ProjectsDatabase.getInstance();
ArrayList<Project> projects = projectsDatabase.get();
for(Project project : projects) {
- m_projects.add(project);
+ m_projects.put(project.getResourceId(), project);
project.getCache(); // create a cache
}
}
/* ----------------- */
- private TreeSet<Project> m_projects;
+ private TreeMap<String, Project> m_projects;
private DateTime m_lastSync;
private Searcher m_currentSearcher;
private Comparator<Project> m_currentComparator;
private static String KEY_LAST_SYNC = "lastSync";
- public TreeSet<Project> getProjects() {
- return m_projects;
+ public Collection<Project> getProjects() {
+ return m_projects.values();
}
public void forceSyncAll(final WhatToDo<Project> projectWhatToDo) {
for(Project project : projects) {
if(project.isActive()) {
- if(m_projects.contains(project)) {
+ if(m_projects.containsKey(project.getResourceId())) {
updatedProjects.add(project);
+ m_projects.put(project.getResourceId(), project);
project.getCache().forceRetrieve().setResource(project);
}
else {
newProjects.add(project);
+ m_projects.put(project.getResourceId(), project);
project.getCache(); // create a cache
}
}
else {
deletedProject.add(project);
+ m_projects.remove(project.getResourceId());
}
projectWhatToDo.hold(project);
}
- m_projects.addAll(newProjects);
- m_projects.removeAll(deletedProject);
-
_this.syncLocalDatabase(newProjects, updatedProjects, deletedProject);
projectWhatToDo.eventually();
}
private ArrayList<Project> restrict(Filter filter) {
ArrayList<Project> res = new ArrayList<Project>();
- for(Project project : m_projects) {
+ for(Map.Entry<String, Project> entry : m_projects.entrySet()) {
+ Project project = entry.getValue();
if(filter.filterTest(project)) {
res.add(project);
}
m_currentSearcher = searcher;
ArrayList<Project> res = new ArrayList<Project>();
- for(Project project : m_projects) {
+ for(Map.Entry<String, Project> entry : m_projects.entrySet()) {
+ Project project = entry.getValue();
if(searcher.searchTest(project, motif)) {
res.add(project);
}
}
+
return res;
}
return sort(new Comparator<Project>() {
@Override
public int compare(Project lhs, Project rhs) {
- return Calcul.distance(Share.position, rhs.getPosition()).compareTo(Calcul.distance(Share.position, lhs.getPosition()));
+ return Calcul.distance(Share.position, lhs.getPosition()).compareTo(Calcul.distance(Share.position, rhs.getPosition()));
}
});
private ArrayList<Project> sort(final Comparator<Project> sorter) {
m_currentComparator = sorter;
- ArrayList<Project> res = new ArrayList<Project>(m_projects);
+ ArrayList<Project> res = new ArrayList<Project>(getProjects());
Collections.sort(res, sorter);
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.DateTimeFormatterBuilder;
+import java.util.ArrayList;
+
import adullact.publicrowdfunding.R;
+import adullact.publicrowdfunding.model.local.ressource.Project;
/**
* @author Ferrand and Nelaupe
return date.toString(dateTimeFormatter);
}
- public static int getDrawable(int numero) {
- switch (numero) {
- case 1:
- return R.drawable.roi;
- case 2:
- return R.drawable.basketball;
- case 3:
- return R.drawable.plante;
- case 4:
- return R.drawable.fete;
-
- default:
- return R.drawable.ic_launcher;
- }
+ public static ArrayList<Project> restrictToUsefulProjects(ArrayList<Project> projects) {
+ ArrayList<Project> res = new ArrayList<Project>();
+
+ for(Project project : projects) {
+ if(project.isValidate() && project.isActive()) {
+ res.add(project);
+ }
+ }
+
+ return res;
+ }
+
+ public static int [] drawables = { R.drawable.ic_launcher, R.drawable.roi, R.drawable.basketball, R.drawable.plante, R.drawable.fete};
+
+ public static int getDrawable(int numero) {
+ return drawables[numero];
}
+
+ public static int getDrawableSize(){
+ return drawables.length;
+ }
+
}
+++ /dev/null
-package adullact.publicrowdfunding.model.local.utilities;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-
-import adullact.publicrowdfunding.model.local.ressource.Project;
-
-import com.google.android.gms.maps.model.LatLng;
-
-public class sortProjects {
-
- public static void sortBiggestProjectFirst(ArrayList<Project> projetsToDisplay) {
-
- // Du plus petit au plus grand
- Collections.sort(projetsToDisplay, new Comparator<Project>() {
-
- @Override
- public int compare(Project lhs, Project rhs) {
- if (Integer.parseInt(lhs.getRequestedFunding()) >= Integer
- .parseInt(rhs.getRequestedFunding())) {
- return -1;
- } else {
- return 1;
- }
- }
- });
-
- }
-
- public static void sortBiggestProjectLast(ArrayList<Project> projetsToDisplay) {
-
- // Du plus petit au plus grand
- Collections.sort(projetsToDisplay, new Comparator<Project>() {
-
- @Override
- public int compare(Project lhs, Project rhs) {
- if (Integer.parseInt(lhs.getRequestedFunding()) >= Integer
- .parseInt(rhs.getRequestedFunding())) {
- return 1;
- } else {
- return -1;
- }
- }
- });
-
- }
-
- public static void sortAlmostFunded(ArrayList<Project> projetsToDisplay) {
-
- // Du plus petit au plus grand
- Collections.sort(projetsToDisplay, new Comparator<Project>() {
-
- @Override
- public int compare(Project lhs, Project rhs) {
- if (lhs.getPercentOfAchievement() >= rhs
- .getPercentOfAchievement()) {
- return -1;
- } else {
- return 1;
- }
- }
- });
-
- }
-
- public static void sortClothersProject(ArrayList<Project> projetsToDisplay) {
-
- // Du plus petit au plus grand
- Collections.sort(projetsToDisplay, new Comparator<Project>() {
-
- @Override
- public int compare(Project lhs, Project rhs) {
-
- LatLng PositionProject1 = lhs.getPosition();
- LatLng PositionProject2 = rhs.getPosition();
-
- int projectOneToMe = Calcul.distance(Share.position, PositionProject1);
- int projectTwoToMe = Calcul.distance(Share.position, PositionProject2);
-
- if (projectOneToMe < projectTwoToMe) {
- return -1;
- } else {
- return 1;
- }
- }
- });
- }
-}
package adullact.publicrowdfunding.model.server.errorHandler;
-import retrofit.RetrofitError;
import adullact.publicrowdfunding.model.server.event.AdministratorEvent;
import adullact.publicrowdfunding.model.server.request.AdministratorRequest;
+import retrofit.RetrofitError;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.server.errorHandler;
-import retrofit.RetrofitError;
import adullact.publicrowdfunding.model.server.event.AuthenticatedEvent;
import adullact.publicrowdfunding.model.server.request.AuthenticatedRequest;
+import retrofit.RetrofitError;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.server.errorHandler;
-import retrofit.RetrofitError;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.event.CreateEvent;
import adullact.publicrowdfunding.model.server.request.CreateRequest;
+import retrofit.RetrofitError;
/**
* @author Ferrand and Nelaupe
*/
public class CreateErrorHandler<TResource extends Resource<TResource, ?, ?>>
- extends AuthenticatedErrorHandler<CreateRequest<TResource,?,?>,CreateEvent<TResource>,CreateErrorHandler<TResource>> {
+ extends AdministratorErrorHandler<CreateRequest<TResource,?,?>,CreateEvent<TResource>,CreateErrorHandler<TResource>> {
private boolean m_resourceIdAlreadyExist = false;
@Override
package adullact.publicrowdfunding.model.server.errorHandler;
-import retrofit.RetrofitError;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.event.DeleteEvent;
import adullact.publicrowdfunding.model.server.request.DeleteRequest;
+import retrofit.RetrofitError;
/**
* @author Ferrand and Nelaupe
import java.io.InputStream;
import java.io.InputStreamReader;
-import retrofit.RetrofitError;
import adullact.publicrowdfunding.model.server.ServerObject;
import adullact.publicrowdfunding.model.server.event.Event;
import adullact.publicrowdfunding.model.server.request.Request;
+import retrofit.RetrofitError;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.server.errorHandler;
-import retrofit.RetrofitError;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.event.UpdateEvent;
import adullact.publicrowdfunding.model.server.request.UpdateRequest;
+import retrofit.RetrofitError;
/**
* @author Ferrand and Nelaupe
* @author Ferrand and Nelaupe
*/
public abstract class CreateEvent<TResource extends Resource<TResource, ?, ?>>
- extends AuthenticatedEvent<CreateRequest<TResource,?,?>,CreateEvent<TResource>,CreateErrorHandler<TResource>> {
+ extends AdministratorEvent<CreateRequest<TResource,?,?>,CreateEvent<TResource>,CreateErrorHandler<TResource>> {
/* Callback functions */
public abstract void errorResourceIdAlreadyUsed();
package adullact.publicrowdfunding.model.server.request;
+import adullact.publicrowdfunding.model.exception.NoAccountExistsInLocal;
import adullact.publicrowdfunding.model.local.ressource.Account;
import adullact.publicrowdfunding.model.server.errorHandler.AuthenticatedErrorHandler;
import adullact.publicrowdfunding.model.server.event.AuthenticatedEvent;
extends Request<TRequest, TEvent, TErrorHandler> {
private String m_username;
private String m_password;
+ private boolean m_authorized;
public AuthenticatedRequest(TEvent event, TErrorHandler errorHandler) {
super(event, errorHandler);
- this.m_username = Account.getOwnOrAnonymous().getUsername();
- this.m_password = Account.getOwnOrAnonymous().getPassword();
-
- SecurityRequestInterceptor securityRequestInterceptor = new SecurityRequestInterceptor();
- securityRequestInterceptor.defineAuthenticator(m_username, m_password);
- defineRequestInterceptor(securityRequestInterceptor);
+ if(Account.isConnect()) {
+ try {
+ this.m_username = Account.getOwn().getUsername();
+ this.m_password = Account.getOwn().getPassword();
+ this.m_authorized = true;
+ } catch (NoAccountExistsInLocal noAccountExistsInLocal) {
+ this.m_authorized = false;
+ event().errorAuthenticationRequired();
+ }
+ }
+ else {
+ this.m_authorized = false;
+ event().errorAuthenticationRequired();
+ }
+ securityRequestCreate();
}
public AuthenticatedRequest(String username, String password, TEvent event, TErrorHandler errorHandler) {
super(event, errorHandler);
- SecurityRequestInterceptor securityRequestInterceptor = new SecurityRequestInterceptor();
- securityRequestInterceptor.defineAuthenticator(username, password);
- defineRequestInterceptor(securityRequestInterceptor);
-
this.m_username = username;
this.m_password = password;
+ this.m_authorized = true;
+ securityRequestCreate();
+ }
+
+ private void securityRequestCreate() {
+ SecurityRequestInterceptor securityRequestInterceptor = new SecurityRequestInterceptor();
+ securityRequestInterceptor.defineAuthenticator(m_username, m_password);
+ defineRequestInterceptor(securityRequestInterceptor);
}
public String username() {
this.m_password = password;
}
+ @Override
+ public void execute() {
+ if(m_authorized) {
+ secureExecute();
+ }
+ }
+
+ public abstract void secureExecute();
}
package adullact.publicrowdfunding.model.server.request;
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
import adullact.publicrowdfunding.model.local.ressource.Account;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.errorHandler.AuthenticationErrorHandler;
import adullact.publicrowdfunding.model.server.event.AuthenticationEvent;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
/**
* @author Ferrand and Nelaupe
}
@Override
- public void execute() {
+ public void secureExecute() {
service().authenticate().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<SimpleServerResponse>() {
package adullact.publicrowdfunding.model.server.request;
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.entities.RowAffected;
import adullact.publicrowdfunding.model.server.errorHandler.CreateErrorHandler;
import adullact.publicrowdfunding.model.server.event.CreateEvent;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
/**
* @author Ferrand and Nelaupe
*/
public class CreateRequest<TResource extends Resource<TResource, TServerResource, TDetailedServerResource>, TServerResource, TDetailedServerResource extends TServerResource>
extends
- AuthenticatedRequest<CreateRequest<TResource,?,?>,CreateEvent<TResource>,CreateErrorHandler<TResource>> {
+ AdministratorRequest<CreateRequest<TResource,?,?>,CreateEvent<TResource>,CreateErrorHandler<TResource>> {
private TResource m_resource;
public CreateRequest(TResource resource, CreateEvent<TResource> event) {
}
@Override
- public void execute() {
+ public void secureExecute() {
m_resource.methodPOST(service()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<RowAffected>() {
@Override
package adullact.publicrowdfunding.model.server.request;
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.errorHandler.DeleteErrorHandler;
import adullact.publicrowdfunding.model.server.event.DeleteEvent;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
/**
* @author Ferrand and Nelaupe
}
@Override
- public void execute() {
+ public void secureExecute() {
m_resource.methodDELETE(service()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<SimpleServerResponse>() {
@Override
import java.util.ArrayList;
import java.util.Map;
+import adullact.publicrowdfunding.model.local.ressource.Resource;
+import adullact.publicrowdfunding.model.server.errorHandler.ListerErrorHandler;
+import adullact.publicrowdfunding.model.server.event.ListerEvent;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
-import adullact.publicrowdfunding.model.local.ressource.Resource;
-import adullact.publicrowdfunding.model.server.errorHandler.ListerErrorHandler;
-import adullact.publicrowdfunding.model.server.event.ListerEvent;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.server.request;
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
import adullact.publicrowdfunding.model.local.ressource.Account;
import adullact.publicrowdfunding.model.server.entities.ServerRegistrationResponse;
import adullact.publicrowdfunding.model.server.errorHandler.RegistrationErrorHandler;
import adullact.publicrowdfunding.model.server.event.RegistrationEvent;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.server.request;
-import retrofit.RequestInterceptor;
-import retrofit.RestAdapter;
import adullact.publicrowdfunding.model.server.ServerObject;
import adullact.publicrowdfunding.model.server.entities.Service;
import adullact.publicrowdfunding.model.server.errorHandler.ErrorHandler;
import adullact.publicrowdfunding.model.server.event.Event;
+import retrofit.RequestInterceptor;
+import retrofit.RestAdapter;
/**
* @author Ferrand and Nelaupe
extends ServerObject<TRequest, TEvent, TErrorHandler> {
private boolean m_done;
private Service m_service;
-
-
-
-
+
public Request(TEvent event, TErrorHandler errorHandler){
super(event, errorHandler);
protected void defineRequestInterceptor(RequestInterceptor requestInterceptor) {
m_service = new RestAdapter.Builder()
- .setLogLevel(RestAdapter.LogLevel.FULL)
+ .setLogLevel(RestAdapter.LogLevel.FULL)
.setRequestInterceptor(requestInterceptor)
.setErrorHandler(errorHandler())
.setEndpoint(SERVER_URL).build()
package adullact.publicrowdfunding.model.server.request;
+import adullact.publicrowdfunding.model.local.ressource.Resource;
+import adullact.publicrowdfunding.model.server.errorHandler.RetrieveErrorHandler;
+import adullact.publicrowdfunding.model.server.event.RetrieveEvent;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
-import adullact.publicrowdfunding.model.local.ressource.Resource;
-import adullact.publicrowdfunding.model.server.errorHandler.RetrieveErrorHandler;
-import adullact.publicrowdfunding.model.server.event.RetrieveEvent;
/**
* @author Ferrand and Nelaupe
package adullact.publicrowdfunding.model.server.request;
-import retrofit.RequestInterceptor;
import android.util.Base64;
+import retrofit.RequestInterceptor;
+
/**
* @author Ferrand and Nelaupe
*/
package adullact.publicrowdfunding.model.server.request;
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
import adullact.publicrowdfunding.model.local.ressource.Resource;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.errorHandler.UpdateErrorHandler;
import adullact.publicrowdfunding.model.server.event.UpdateEvent;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
/**
* @author Ferrand and Nelaupe
}
@Override
- public void execute() {
+ public void secureExecute() {
m_resource.methodPUT(service()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<SimpleServerResponse>() {
@Override
Version encore non stable, toujours en développement
+## Screenshot
+
+![Screenshot](https://github.com/Crikka/appli-libre/blob/master/screen/multiscreen.png)
+
## Contributors
* [Lucas Nelaupe](http://www.lucasnelaupe.fr/) - <https://github.com/lucas34>