Ajout des fragments

This commit is contained in:
Hugo 2015-06-24 23:22:02 +02:00
parent cfcd4e6862
commit 6f7e75d20c
43 changed files with 1311 additions and 882 deletions

View File

@ -25,8 +25,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
@ -35,6 +35,7 @@ android {
}
signingConfigs {
release {
}
}
@ -48,11 +49,18 @@ android {
}
}
configurations {
compile.exclude group: 'stax'
compile.exclude group: 'xpp3'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'
compile 'com.google.android.gms:play-services:4.3.23'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.pnikosis:materialish-progress:1.5'

View File

@ -9,7 +9,6 @@
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -18,7 +17,7 @@
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity
android:name=".MainActivity"
android:name=".listfavorites.ListFavoritesActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
@ -27,37 +26,37 @@
</intent-filter>
</activity>
<activity
android:name=".ShopDisplay"
android:name=".shopdetail.DetailShopActivity"
android:label="@string/app_name"
android:parentActivityName=".MainActivity">
android:parentActivityName=".listfavorites.ListFavoritesActivity">
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
android:value=".listfavorites.ListFavoritesActivity"/>
<intent-filter>
<category android:name="android.intent.category.ALTERNATIVE"/>
</intent-filter>
</activity>
<activity
android:name=".ShopSearch"
android:name=".search.SearchActivity"
android:label="@string/app_name"
android:parentActivityName=".MainActivity">
android:parentActivityName=".listfavorites.ListFavoritesActivity">
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
android:value=".listfavorites.ListFavoritesActivity"/>
<intent-filter>
<category android:name="android.intent.category.ALTERNATIVE"/>
</intent-filter>
</activity>
<activity
android:name=".ShopUpdate"
android:name=".updateshop.UpdateShopActivity"
android:label="@string/app_name"
android:parentActivityName=".ShopDisplay">
android:parentActivityName=".shopdetail.DetailShopActivity">
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ShopDisplay"/>
android:value=".shopdetail.DetailShopActivity"/>
<intent-filter>
<category android:name="android.intent.category.ALTERNATIVE"/>
</intent-filter>

View File

@ -1,15 +0,0 @@
package com.amine.horaires;
import android.app.Application;
public class App extends Application {
public App() {
super();
}
@Override
public void onCreate() {
super.onCreate();
}
}

View File

@ -1,132 +0,0 @@
package com.amine.horaires;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.telephony.TelephonyManager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.TextView;
import com.amine.horaires.bdd.FavorisDao;
import com.amine.horaires.models.Shop;
import com.amine.horaires.util.Configuration;
import com.amine.horaires.util.Parseur;
import com.melnykov.fab.FloatingActionButton;
import de.cketti.library.changelog.ChangeLog;
import java.util.ArrayList;
public class MainActivity extends OptionsActivity {
private static RecyclerView mRecyclerView;
private static RecyclerView.Adapter mAdapter;
private static ArrayList<Shop> myDataset;
private static TextView emptyView;
static void razOrFavs(Context c) {
FavorisDao dao = FavorisDao.getInstance(c);
dao.open();
myDataset = dao.getAllFavoris();
dao.close();
if (myDataset.isEmpty()) {
mRecyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
} else {
mAdapter = new SearchAdapter(myDataset, c);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setVisibility(View.VISIBLE);
emptyView.setVisibility(View.GONE);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
checkLocale();
ChangeLog cl = new ChangeLog(this);
if (cl.isFirstRun()) {
cl.getLogDialog().show();
}
mRecyclerView = (RecyclerView) findViewById(R.id.favs_list);
emptyView = (TextView) findViewById(R.id.empty_list);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.attachToRecyclerView(mRecyclerView);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent i = new Intent(getBaseContext(), ShopSearch.class);
startActivityForResult(i, 0);
}
});
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
// specify an adapter (see also next example)
myDataset = new ArrayList<Shop>();
razOrFavs(getBaseContext());
}
private void checkLocale() {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
Configuration.pays = tm.getSimCountryIso().toUpperCase();
if (Configuration.pays == null || Configuration.pays.equals("") || Configuration.pays.isEmpty())
Configuration.pays = MainActivity.this.getResources().getConfiguration().locale.getCountry();
SharedPreferences settings = getSharedPreferences("UserInfo", 0);
if (settings.getString("Pays", "") == null || !settings.getString("Pays", "").equals(Configuration.pays)) {
settings = getSharedPreferences("UserInfo", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("Pays", Configuration.pays);
editor.apply();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case (0): {
if (resultCode == Activity.RESULT_OK) {
myDataset = new ArrayList<Shop>();
String result = data.getStringExtra("result");
myDataset = new Parseur().parserShops(result);
if (myDataset.isEmpty()) {
mRecyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
} else {
mAdapter = new SearchAdapter(myDataset, getBaseContext());
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setVisibility(View.VISIBLE);
emptyView.setVisibility(View.GONE);
}
}
break;
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_actions_main, menu);
return super.onCreateOptionsMenu(menu);
}
}

View File

@ -12,9 +12,8 @@ import com.amine.horaires.bdd.FavorisDao;
import com.amine.horaires.models.Shop;
import com.amine.horaires.util.Configuration;
class OptionsActivity extends AppCompatActivity {
MenuItem favMenu = null;
boolean isFav = false;
public class OptionsActivity extends AppCompatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
@ -22,7 +21,10 @@ class OptionsActivity extends AppCompatActivity {
return super.onCreateOptionsMenu(menu);
}
public boolean onOptionsItemSelected(MenuItem item) {
/*
* Default operation, when the user click on the menu.
*/
public boolean defaultOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_mail:
Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
@ -42,22 +44,7 @@ class OptionsActivity extends AppCompatActivity {
dialog.show();
return true;
case R.id.action_reload:
MainActivity.razOrFavs(OptionsActivity.this);
return true;
case R.id.action_fav:
FavorisDao dao = FavorisDao.getInstance(OptionsActivity.this);
if (isFav) {
// REMOVE
dao.open();
dao.deleteFavori(Configuration.currentShop.getId());
dao.close();
updateFavStatus(false);
} else {
dao.open();
dao.insertFavori(Configuration.currentShop);
dao.close();
updateFavStatus(true);
}
//MainActivity.razOrFavs(OptionsActivity.this);
return true;
case android.R.id.home:
this.finish();
@ -67,23 +54,4 @@ class OptionsActivity extends AppCompatActivity {
}
}
private void updateFavStatus(boolean state) {
if (state) {
favMenu.setIcon(R.mipmap.ic_turned_in_black_24dp);
} else {
favMenu.setIcon(R.mipmap.ic_turned_in_not_black_24dp);
}
}
void updateFavStatus() {
FavorisDao dao = FavorisDao.getInstance(OptionsActivity.this);
dao.open();
Shop sh = dao.getFavori(Configuration.currentShop.getId());
dao.close();
if (sh == null) {
updateFavStatus(false);
} else {
updateFavStatus(true);
}
}
}

View File

@ -1,88 +0,0 @@
package com.amine.horaires;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.amine.horaires.models.Shop;
import java.util.ArrayList;
public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder> {
private final ArrayList<Shop> mDataset;
private final Context c;
// Provide a suitable constructor (depends on the kind of dataset)
public SearchAdapter(ArrayList<Shop> myDataset, Context c) {
mDataset = myDataset;
this.c = c;
}
// Create new views (invoked by the layout manager)
@Override
public SearchAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a new view
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.fav_list_item, parent, false);
// set the view's size, margins, paddings and layout parameters
return new ViewHolder((RelativeLayout) v, c, mDataset);
}
// Replace the contents of a view (invoked by the layout manager)
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
// - get element from your dataset at this position
// - replace the contents of the view with that element
holder.shopAddr.setText(mDataset.get(position).getAdresse());
holder.shopName.setText(mDataset.get(position).getName());
}
// Return the size of your dataset (invoked by the layout manager)
@Override
public int getItemCount() {
return mDataset.size();
}
// Provide a reference to the views for each data item
// Complex data items may need more than one view per item, and
// you provide access to all the views for a data item in a view holder
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
// each data item is just a string in this case
public final TextView shopName;
public final TextView shopAddr;
private final Context c;
private final ArrayList<Shop> mDataset;
public ViewHolder(RelativeLayout v, Context c, ArrayList<Shop> mDataset) {
super(v);
v.setOnClickListener(this);
shopName = (TextView) v.findViewById(R.id.shop_name);
shopAddr = (TextView) v.findViewById(R.id.shop_adress);
this.c = c;
this.mDataset = mDataset;
}
@Override
public void onClick(View view) {
final Intent i = new Intent(view.getContext(), ShopDisplay.class);
final Handler handler = new Handler();
Runnable t = new Runnable() {
public void run() {
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("shop", mDataset.get(getLayoutPosition()));
c.startActivity(i);
}
};
handler.post(t);
}
}
}

View File

@ -1,134 +0,0 @@
package com.amine.horaires;
import android.content.Intent;
import android.location.Location;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.amine.horaires.util.MyLocation;
import com.amine.horaires.util.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.Scanner;
public class ShopSearch extends OptionsActivity {
private MyLocation myLocation;
private RelativeLayout loading;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shop_search);
final EditText name = (EditText) findViewById(R.id.name);
final EditText location = (EditText) findViewById(R.id.location);
loading = (RelativeLayout) findViewById(R.id.loading);
Button searchButton = (Button) findViewById(R.id.searchAction);
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (name.getText().toString().trim().length() > 0 && location.getText().toString().trim().length() > 0) {
loading.setVisibility(View.VISIBLE);
SearchTask s = new SearchTask();
s.execute(Utils.generateUrlForTextLocation(name.getText().toString(), location.getText().toString()));
}
}
});
findViewById(R.id.gpsAction).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loading.setVisibility(View.VISIBLE);
MyLocation.LocationResult locationResult = new MyLocation.LocationResult() {
@Override
public void gotLocation(Location location) {
if (location == null) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.fail_localize_user), Toast.LENGTH_SHORT).show();
} else {
URL url = Utils.generateUrlForLatLng(name.getText().toString(), location.getLatitude() + "", location.getLongitude() + "");
SearchTask s = new SearchTask();
s.execute(url);
}
}
};
myLocation = new MyLocation();
boolean gotLocation = myLocation.getLocation(getApplicationContext(),
locationResult);
if (!gotLocation) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.fail_localize_user), Toast.LENGTH_SHORT).show();
}
}
});
}
private class SearchTask extends AsyncTask<URL, Void, String> {
@Override
protected String doInBackground(URL... params) {
HttpURLConnection conn = null;
InputStream is = null;
String contentAsString = "";
URL url = null;
try {
url = params[0];
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestMethod("GET");
conn.setDoInput(true);
// Starts the query
conn.connect();
is = conn.getInputStream();
// Convert the InputStream into a String
Scanner reader = new Scanner(is, "ISO-8859-1");
while (reader.hasNextLine()) {
contentAsString = contentAsString + reader.nextLine();
}
} catch (MalformedURLException e) {
Log.e("ShopSearch", "The API doesn't respond correctly. Asked url was " + url.toString(), e);
} catch (ProtocolException e) {
Log.e("ShopSearch", "The protocol doesn't seems to be HTTP. Url was " + url.toString(), e);
} catch (IOException e) {
Log.e("ShopSearch", "The API response is not readable. Url was " + url.toString(), e);
} finally {
// Makes sure that the InputStream is closed after the app is finished using it.
if (is != null)
try {
is.close();
} catch (IOException e) {}
if (conn != null)
conn.disconnect();
}
return contentAsString;
}
@Override
protected void onPostExecute(String string) {
super.onPostExecute(string);
loading.setVisibility(View.GONE);
Intent resultIntent = new Intent();
resultIntent.putExtra("result", string);
setResult(MainActivity.RESULT_OK, resultIntent);
finish();
}
}
}

View File

@ -65,6 +65,10 @@ public class FavorisDao {
bdd = maBaseSQLite.getWritableDatabase();
}
public void openReadable() {
bdd = maBaseSQLite.getWritableDatabase();
}
public void close() {
bdd.close();
}

View File

@ -0,0 +1,110 @@
package com.amine.horaires.listfavorites;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import com.amine.horaires.OptionsActivity;
import com.amine.horaires.R;
import com.amine.horaires.bdd.FavorisDao;
import com.amine.horaires.listshop.ListShopsFragment;
import com.amine.horaires.models.Shop;
import com.amine.horaires.search.SearchActivity;
import com.amine.horaires.util.Configuration;
import com.melnykov.fab.FloatingActionButton;
import de.cketti.library.changelog.ChangeLog;
import java.util.ArrayList;
public class ListFavoritesActivity extends OptionsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (findViewById(R.id.fragmentContainer) != null) {
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
// Create a new Fragment to be placed in the activity layout
ListShopsFragment firstFragment = new ListShopsFragment();
// Get all favorites shops
FavorisDao dao = FavorisDao.getInstance(getApplicationContext());
dao.openReadable();
ArrayList<Shop> shops = dao.getAllFavoris();
Bundle args = new Bundle();
args.putParcelableArrayList("list", shops);
args.putString("errorEmptyList", getErrorMessageListFavoritesEmpty());
firstFragment.setArguments(args);
// Add the fragment to the 'fragment_container' FrameLayout
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, firstFragment).commit();
}
// Save user country
saveUserCountry();
// Display changelog
ChangeLog cl = new ChangeLog(this);
if (cl.isFirstRun()) {
cl.getLogDialog().show();
}
// Configure SearchButton
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
search();
}
});
}
/**
* Used when the fragment want to launch the Search.
*/
private void search() {
Intent intent = new Intent(this, SearchActivity.class);
startActivity(intent);
}
public String getErrorMessageListFavoritesEmpty() {
return getString(R.string.listvide);
}
/**
* We save the user country to display the best api url.
*/
private void saveUserCountry() {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
Configuration.pays = tm.getSimCountryIso().toUpperCase();
if (Configuration.pays == null || Configuration.pays.equals("") || Configuration.pays.isEmpty())
Configuration.pays = ListFavoritesActivity.this.getResources().getConfiguration().locale.getCountry();
SharedPreferences settings = getSharedPreferences("UserInfo", 0);
if (settings.getString("Pays", "") == null || !settings.getString("Pays", "").equals(Configuration.pays)) {
settings = getSharedPreferences("UserInfo", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("Pays", Configuration.pays);
editor.apply();
}
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
return defaultOptionsItemSelected (menuItem);
}
}

View File

@ -0,0 +1,61 @@
package com.amine.horaires.listshop;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.amine.horaires.R;
import com.amine.horaires.models.Shop;
import java.util.List;
public class ListShopsAdapter extends RecyclerView.Adapter<ListShopsAdapter.ShopViewHolder> {
private List<Shop> shops;
ListShopsAdapter(List<Shop> shop){
this.shops = shop;
}
public class ShopViewHolder extends RecyclerView.ViewHolder {
private CardView cv;
private TextView shopName;
private TextView shopAddress;
ShopViewHolder(View itemView) {
super(itemView);
cv = (CardView)itemView.findViewById(R.id.card_view);
shopName = (TextView)itemView.findViewById(R.id.shop_name);
shopAddress = (TextView)itemView.findViewById(R.id.shop_adress);
}
public TextView getShopName() {
return shopName;
}
public TextView getShopAddress() {
return shopAddress;
}
}
@Override
public ShopViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_shop_item, parent, false);
ShopViewHolder pvh = new ShopViewHolder(v);
return pvh;
}
@Override
public void onBindViewHolder(ShopViewHolder holder, int position) {
holder.getShopName().setText(shops.get(position).getName());
holder.getShopAddress().setText(shops.get(position).getAdresse());
}
@Override
public int getItemCount() {
return shops.size();
}
}

View File

@ -0,0 +1,84 @@
package com.amine.horaires.listshop;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.amine.horaires.R;
import com.amine.horaires.models.Shop;
import com.amine.horaires.shopdetail.DetailShopActivity;
import com.amine.horaires.util.RecyclerItemClickListener;
import com.melnykov.fab.FloatingActionButton;
import java.util.List;
public class ListShopsFragment extends Fragment {
private List<Shop> shops;
private ListShopsAdapter adapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_list_shops, container, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
shops = getArguments().getParcelableArrayList("list");
// Get list android component
RecyclerView favsRecyclerView = (RecyclerView) getView().findViewById(R.id.list);
if (shops.isEmpty()) {
favsRecyclerView.setVisibility(View.GONE);
TextView emptyView = (TextView) getView().findViewById(R.id.empty_list);
emptyView.setVisibility(View.VISIBLE);
emptyView.setText(getArguments().getString("errorEmptyList"));
}
else {
// Create an Adapter: provides access to the data items and is also responsible for making a View for each item
adapter = new ListShopsAdapter(shops);
favsRecyclerView.setAdapter(adapter);
// Create a LayoutManager: Layout Manager is responsible for measuring and positioning item views within a RecyclerView
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
favsRecyclerView.setLayoutManager(layoutManager);
// Improve performances, the list have a fixed size
favsRecyclerView.setHasFixedSize(true);
// Open the shop on click
favsRecyclerView.addOnItemTouchListener(
new RecyclerItemClickListener(getActivity().getApplicationContext(),
new RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, final int position) {
final Intent i = new Intent(view.getContext(), DetailShopActivity.class);
final Handler handler = new Handler();
Runnable t = new Runnable() {
public void run() {
i.putExtra("shop", shops.get(position));
getActivity().startActivity(i);
}
};
handler.post(t);
}
}
)
);
}
}
}

View File

@ -0,0 +1,10 @@
package com.amine.horaires.search;
import com.amine.horaires.models.Shop;
import java.util.List;
public interface OnSearchResult {
void onPostExecute(List<Shop> result);
}

View File

@ -0,0 +1,94 @@
package com.amine.horaires.search;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import com.amine.horaires.listshop.ListShopsFragment;
import com.amine.horaires.OptionsActivity;
import com.amine.horaires.R;
import com.amine.horaires.models.Shop;
import com.melnykov.fab.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class SearchActivity extends OptionsActivity implements OnSearchResult {
private FloatingActionButton fab;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
if (findViewById(R.id.fragmentContainer) != null) {
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
// Create a new Fragment to be placed in the activity layout
SearchFragment firstFragment = new SearchFragment();
// Add the fragment to the 'fragmentContainer' FrameLayout
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, firstFragment).commit();
}
// Configure SearchButton
fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
search();
}
});
fab.setVisibility(View.INVISIBLE);
}
/**
* Used when the fragment want to launch the Search.
*/
private void search() {
Intent intent = new Intent(this, SearchActivity.class);
startActivity(intent);
}
/**
* The search have found some result, need to update the fragments
*/
@Override
public void onPostExecute(List<Shop> result) {
ListShopsFragment listSearchResultFragment = new ListShopsFragment();
Bundle args = new Bundle();
args.putParcelableArrayList("list", (ArrayList) result);
args.putString("errorEmptyList", getErrorMessageResultListEmpty());
listSearchResultFragment.setArguments(args);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragmentContainer, listSearchResultFragment);
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
fab.setVisibility(View.VISIBLE);
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
return defaultOptionsItemSelected (menuItem);
}
public String getErrorMessageResultListEmpty() {
return getString(R.string.resultatRechercheVide);
}
}

View File

@ -0,0 +1,175 @@
package com.amine.horaires.search;
import android.content.Intent;
import android.location.Location;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.amine.horaires.R;
import com.amine.horaires.models.Shop;
import com.amine.horaires.shopdetail.UpdateActionBar;
import com.amine.horaires.util.MyLocation;
import com.amine.horaires.util.Parseur;
import com.amine.horaires.util.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.List;
import java.util.Scanner;
public class SearchFragment extends Fragment {
private EditText name;
private EditText location;
private Button searchButton;
private RelativeLayout loading;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_search, container, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// If the user is not connected to a network, display an error
if (!Utils.checkDeviceConnected (getActivity().getApplicationContext())) {
Toast.makeText(getActivity().getApplicationContext(), getResources().getString(R.string.fail_connexion), Toast.LENGTH_SHORT).show();
}
else {
// Android component form
name = (EditText) getView().findViewById(R.id.name);
location = (EditText) getView().findViewById(R.id.location);
searchButton = (Button) getView().findViewById(R.id.searchAction);
// Load icons. Useful to show to the user, that something is loading.
loading = (RelativeLayout) getView().findViewById(R.id.loading);
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// If the user complete the form
if (name.getText().toString().trim().length() > 0 && location.getText().toString().trim().length() > 0) {
// Show to the user that we performs the user
loading.setVisibility(View.VISIBLE);
SearchTask s = new SearchTask();
s.execute(Utils.generateUrlForTextLocation(name.getText().toString(), location.getText().toString()));
}
}
});
getView().findViewById(R.id.gpsAction).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (name.getText().toString().trim().length() > 0) {
loading.setVisibility(View.VISIBLE);
MyLocation myLocation = new MyLocation();
boolean gotLocation = myLocation.getLocation(getActivity().getApplicationContext(), new MyLocation.LocationResult() {
@Override
public void gotLocation(Location location) {
if (location == null) {
displayLocalizeError();
} else {
URL url = Utils.generateUrlForLatLng(name.getText().toString(), location.getLatitude() + "", location.getLongitude() + "");
SearchTask s = new SearchTask();
s.execute(url);
}
}
});
if (!gotLocation) {
displayLocalizeError();
}
} else {
Toast.makeText(getActivity().getApplicationContext(), getResources().getString(R.string.fail_fill_form), Toast.LENGTH_SHORT).show();
}
}
});
}
}
private void displayLocalizeError () {
Toast.makeText(getActivity().getApplicationContext(), getResources().getString(R.string.fail_localize_user), Toast.LENGTH_SHORT).show();
}
private class SearchTask extends AsyncTask<URL, Void, String> {
@Override
protected String doInBackground(URL... params) {
HttpURLConnection conn = null;
InputStream is = null;
String contentAsString = "";
URL url = null;
try {
url = params[0];
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestMethod("GET");
conn.setDoInput(true);
// Starts the query
conn.connect();
is = conn.getInputStream();
// Convert the InputStream into a String
Scanner reader = new Scanner(is, "ISO-8859-1");
while (reader.hasNextLine()) {
contentAsString = contentAsString + reader.nextLine();
}
} catch (MalformedURLException e) {
Log.e("ShopSearch", "The API doesn't respond correctly. Asked url was " + url.toString(), e);
} catch (ProtocolException e) {
Log.e("ShopSearch", "The protocol doesn't seems to be HTTP. Url was " + url.toString(), e);
} catch (IOException e) {
Log.e("ShopSearch", "The API response is not readable. Url was " + url.toString(), e);
} finally {
// Makes sure that the InputStream is closed after the app is finished using it.
if (is != null)
try {
is.close();
} catch (IOException e) {}
if (conn != null)
conn.disconnect();
}
return contentAsString;
}
@Override
protected void onPostExecute(String string) {
super.onPostExecute(string);
loading.setVisibility(View.GONE);
List<Shop> shops = new Parseur().parserShops(string);
((OnSearchResult) getActivity()).onPostExecute(shops);
}
}
}

View File

@ -0,0 +1,82 @@
package com.amine.horaires.shopdetail;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.amine.horaires.OptionsActivity;
import com.amine.horaires.R;
import com.amine.horaires.models.Shop;
public class DetailShopActivity extends OptionsActivity implements UpdateActionBar {
private MenuItem favMenu;
private DetailShopFragment detailShopFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_shop);
Shop s = getIntent().getExtras().getParcelable("shop");
if (findViewById(R.id.fragmentContainer) != null) {
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
// Create a new Fragment to be placed in the activity layout
detailShopFragment = new DetailShopFragment();
Bundle args = new Bundle();
args.putParcelable("shop", s);
detailShopFragment.setArguments(args);
// Add the fragment to the 'fragmentContainer' FrameLayout
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, detailShopFragment).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_actions_shop, menu);
favMenu = menu.findItem(R.id.action_fav);
updateFavsIcon(detailShopFragment.getFav());
return super.onCreateOptionsMenu(menu);
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
boolean isActionPerformed = defaultOptionsItemSelected(menuItem);
if (isActionPerformed) {
return isActionPerformed;
}
else {
if (menuItem.getItemId() == R.id.action_fav) {
detailShopFragment.updateFav();
return true;
}
}
return false;
}
@Override
public void updateFavsIcon(boolean isFav) {
if (isFav) {
favMenu.setIcon(R.mipmap.ic_turned_in_black_24dp);
} else {
favMenu.setIcon(R.mipmap.ic_turned_in_not_black_24dp);
}
}
}

View File

@ -1,23 +1,22 @@
package com.amine.horaires;
package com.amine.horaires.shopdetail;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.amine.horaires.R;
import com.amine.horaires.bdd.FavorisDao;
import com.amine.horaires.models.Shop;
import com.amine.horaires.util.Configuration;
import com.amine.horaires.updateshop.UpdateShopActivity;
import com.amine.horaires.util.Parseur;
import com.amine.horaires.util.Utils;
import com.melnykov.fab.FloatingActionButton;
@ -31,41 +30,48 @@ import java.net.URL;
import java.util.List;
import java.util.Scanner;
public class ShopDisplay extends OptionsActivity {
public class DetailShopFragment extends Fragment implements UpdateFav {
private boolean isFav = false;
private Shop s;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shop_display);
Shop s = getIntent().getExtras().getParcelable("shop");
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_detail_shop, container, false);
}
Configuration.currentShop = s;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
FavorisDao dao = FavorisDao.getInstance(ShopDisplay.this);
dao.open();
s = getArguments().getParcelable("shop");
FavorisDao dao = FavorisDao.getInstance(getActivity().getApplicationContext());
dao.openReadable();
List<Shop> fs = dao.getAllFavoris();
dao.close();
while (!isFav && !fs.isEmpty()) {
isFav = fs.remove(0).getId() == Configuration.currentShop.getId();
isFav = fs.remove(0).getId() == s.getId();
}
if (isFav) {
SearchTask st = new SearchTask();
st.execute(Utils.generateUrlForId(s.getId()));
s = Configuration.currentShop;
dao.open();
dao.updateFavori(s);
dao.close();
}
generateView(s);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
FloatingActionButton fab = (FloatingActionButton) getView().findViewById(R.id.fab);
final Shop finalS = s;
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent i = new Intent(getBaseContext(), ShopUpdate.class);
final Intent i = new Intent(getActivity().getApplicationContext(), UpdateShopActivity.class);
i.putExtra("shop", finalS);
startActivity(i);
}
@ -73,20 +79,19 @@ public class ShopDisplay extends OptionsActivity {
}
private void generateView(final Shop s) {
Configuration.currentShop = s;
ImageView imageResult = (ImageView) findViewById(R.id.imageView);
ImageView imageResult = (ImageView) getView().findViewById(R.id.imageView);
ImageTask t = new ImageTask(imageResult);
t.execute(s.getHoraires());
TextView shopName = (TextView) findViewById(R.id.shopName);
TextView shopAddress = (TextView) findViewById(R.id.shopAdress);
TextView shopOpen = (TextView) findViewById(R.id.shopOpen);
TextView shopStatus = (TextView) findViewById(R.id.shopStatus);
ImageView wifi = (ImageView) findViewById(R.id.wifi);
ImageView parking = (ImageView) findViewById(R.id.parking);
ImageView access = (ImageView) findViewById(R.id.handi);
TextView shopName = (TextView) getView().findViewById(R.id.shopName);
TextView shopAddress = (TextView) getView().findViewById(R.id.shopAdress);
TextView shopOpen = (TextView) getView().findViewById(R.id.shopOpen);
TextView shopStatus = (TextView) getView().findViewById(R.id.shopStatus);
ImageView wifi = (ImageView) getView().findViewById(R.id.wifi);
ImageView parking = (ImageView) getView().findViewById(R.id.parking);
ImageView access = (ImageView) getView().findViewById(R.id.handi);
shopName.setText(s.getName());
shopAddress.setText(s.getAdresse());
@ -107,7 +112,7 @@ public class ShopDisplay extends OptionsActivity {
parking.setAlpha((float) 0.1);
}
findViewById(R.id.imageView).setOnClickListener(new View.OnClickListener() {
getView().findViewById(R.id.imageView).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(s.getUrl()));
@ -115,7 +120,7 @@ public class ShopDisplay extends OptionsActivity {
}
});
findViewById(R.id.callButton).setOnClickListener(new View.OnClickListener() {
getView().findViewById(R.id.callButton).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String numeroAppeler = "tel:" + s.getTel();
startActivity(new Intent(Intent.ACTION_DIAL, Uri
@ -123,7 +128,7 @@ public class ShopDisplay extends OptionsActivity {
}
});
findViewById(R.id.gpsButton).setOnClickListener(new View.OnClickListener() {
getView().findViewById(R.id.gpsButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new
@ -135,24 +140,29 @@ public class ShopDisplay extends OptionsActivity {
}
});
}
// @todo: use this to update the shop if connected.
private boolean checkDeviceConnected() {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
// Need permission : android.permission.ACCESS_NETWORK_STATE
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_actions_shop, menu);
favMenu = menu.findItem(R.id.action_fav);
updateFavStatus();
return super.onCreateOptionsMenu(menu);
public void updateFav() {
FavorisDao dao = FavorisDao.getInstance(getActivity().getApplicationContext());
if (isFav) {
dao.open();
dao.deleteFavori(s.getId());
dao.close();
} else {
dao.open();
dao.insertFavori(s);
dao.close();
}
isFav = !isFav;
((UpdateActionBar) getActivity()).updateFavsIcon(isFav);
}
public boolean getFav() {
return isFav;
}
public class ImageTask extends AsyncTask<String, Void, Bitmap> {
@ -182,7 +192,7 @@ public class ShopDisplay extends OptionsActivity {
conn.disconnect();
} catch (MalformedURLException e) {
Log.e("ShopDisplay", "The API doesn't respond correctly. Asked url was "+url.toString(), e);
Log.e("ShopDisplay", "The API doesn't respond correctly. Asked url was " + url.toString(), e);
} catch (ProtocolException e) {
Log.e("ShopDisplay", "The protocol doesn't seems to be HTTP. Url was " + url.toString(), e);
} catch (IOException e) {
@ -231,11 +241,11 @@ public class ShopDisplay extends OptionsActivity {
contentAsString = contentAsString + reader.nextLine();
}
} catch (MalformedURLException e) {
Log.e("ShopDisplay", "The API doesn't respond correctly. Asked url was " + url.toString(), e);
Log.e("ShopDisplay", "The API doesn't respond correctly. Asked url was " + url.toString(), e);
} catch (ProtocolException e) {
Log.e("ShopDisplay", "The protocol doesn't seems to be HTTP. Url was " + url.toString(), e);
} catch (IOException e) {
Log.e("ShopDisplay", "The API response is not readable. Url was " + url.toString(), e);
Log.e("ShopDisplay", "The API response is not readable. Url was " + url.toString(), e);
} finally {
// Makes sure that the InputStream is closed after the app is finished using it.
if (is != null)
@ -251,7 +261,8 @@ public class ShopDisplay extends OptionsActivity {
@Override
protected void onPostExecute(String string) {
super.onPostExecute(string);
Configuration.currentShop = new Parseur().parserShops(string).get(0);
s = new Parseur().parserShops(string).get(0);
}
}
}

View File

@ -0,0 +1,5 @@
package com.amine.horaires.shopdetail;
public interface UpdateActionBar {
void updateFavsIcon (boolean isFav);
}

View File

@ -0,0 +1,5 @@
package com.amine.horaires.shopdetail;
public interface UpdateFav {
void updateFav ();
}

View File

@ -1,4 +1,4 @@
package com.amine.horaires;
package com.amine.horaires.updateshop;
import android.app.FragmentManager;
import android.content.Context;
@ -6,6 +6,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.amine.horaires.R;
import com.amine.horaires.models.Horaires;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;

View File

@ -0,0 +1,39 @@
package com.amine.horaires.updateshop;
import android.os.Bundle;
import com.amine.horaires.OptionsActivity;
import com.amine.horaires.R;
import com.amine.horaires.models.Shop;
import com.amine.horaires.shopdetail.DetailShopFragment;
public class UpdateShopActivity extends OptionsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_shop);
Shop s = getIntent().getExtras().getParcelable("shop");
if (findViewById(R.id.fragmentContainer) != null) {
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
// Create a new Fragment to be placed in the activity layout
UpdateShopFragment updateShopFragment = new UpdateShopFragment();
Bundle args = new Bundle();
args.putParcelable("shop", s);
updateShopFragment.setArguments(args);
// Add the fragment to the 'fragmentContainer' FrameLayout
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, updateShopFragment).commit();
}
}
}

View File

@ -1,13 +1,17 @@
package com.amine.horaires;
package com.amine.horaires.updateshop;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.amine.horaires.R;
import com.amine.horaires.models.Horaires;
import com.amine.horaires.models.Shop;
import com.amine.horaires.util.Utils;
@ -24,28 +28,34 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
public class ShopUpdate extends OptionsActivity {
public class UpdateShopFragment extends Fragment {
private ArrayList<Horaires> h;
private RelativeLayout loading;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.update_shop);
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_update_shop, container, false);
}
loading = (RelativeLayout) findViewById(R.id.loading);
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Shop s = getIntent().getExtras().getParcelable("shop");
ListView hList = (ListView) findViewById(R.id.horaires_list);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
Button save = (Button) findViewById(R.id.button);
loading = (RelativeLayout) getView().findViewById(R.id.loading);
final Shop s = getArguments().getParcelable("shop");
ListView hList = (ListView) getView().findViewById(R.id.horaires_list);
FloatingActionButton fab = (FloatingActionButton) getView().findViewById(R.id.fab);
Button save = (Button) getView().findViewById(R.id.button);
h = new ArrayList<Horaires>();
initializeHoraires();
final UpdateAdapter adapter = new UpdateAdapter(this, h, getFragmentManager());
final UpdateAdapter adapter = new UpdateAdapter(getActivity().getApplicationContext(), h, getActivity().getFragmentManager());
hList.setAdapter(adapter);
@ -137,7 +147,7 @@ public class ShopUpdate extends OptionsActivity {
protected void onPostExecute(String string) {
loading.setVisibility(View.GONE);
super.onPostExecute(string);
Toast.makeText(getApplicationContext(), getResources().getString(R.string.success_update_shop), Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity().getApplicationContext(), getResources().getString(R.string.success_update_shop), Toast.LENGTH_SHORT).show();
}
}
}

View File

@ -0,0 +1,39 @@
package com.amine.horaires.util;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
public interface OnItemClickListener {
void onItemClick(View view, int position);
}
GestureDetector mGestureDetector;
public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
mListener = listener;
mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override public boolean onSingleTapUp(MotionEvent e) {
return true;
}
});
}
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) {
View childView = view.findChildViewUnder(e.getX(), e.getY());
if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) {
mListener.onItemClick(childView, view.getChildPosition(childView));
return true;
}
return false;
}
@Override public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) { }
@Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {}
}

View File

@ -1,5 +1,8 @@
package com.amine.horaires.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import java.io.UnsupportedEncodingException;
@ -10,6 +13,10 @@ import java.net.URLEncoder;
public class Utils {
public static URL generateUrlForTextLocation(String name, String location) {
try {
System.out.print(new URL(Configuration.getAPIUrl() + "/api?key="
+ Configuration.key + "&h=" + Configuration.hashtag
+ "&get=shops" + "&loc=" + URLEncoder.encode(location, "ISO-8859-1")
+ "&name=" + URLEncoder.encode(name, "ISO-8859-1")));
return new URL(Configuration.getAPIUrl() + "/api?key="
+ Configuration.key + "&h=" + Configuration.hashtag
+ "&get=shops" + "&loc=" + URLEncoder.encode(location, "ISO-8859-1")
@ -63,4 +70,12 @@ public class Utils {
return null;
}
}
public static boolean checkDeviceConnected(Context context) {
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
// Need permission : android.permission.ACCESS_NETWORK_STATE
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected());
}
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
fab:fab_colorNormal="@color/accent"
fab:fab_colorPressed="@color/primary_dark" />
</LinearLayout>

View File

@ -1,32 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
tools:context="${relativePackage}.${activSityClass}">
<android.support.v7.widget.RecyclerView
android:id="@+id/favs_list"
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:scrollbars="vertical"
/>
<TextView
android:id="@+id/empty_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background"
android:gravity="center"
android:text="@string/listvide"
android:textColor="@color/primary"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone"/>
android:layout_height="match_parent" />
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
@ -36,8 +20,8 @@
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/plus"
fab:fab_colorNormal="@color/accent"
android:src="@mipmap/plus"
fab:fab_colorPressed="@color/primary_dark"/>
</RelativeLayout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
fab:fab_colorNormal="@color/accent"
android:src="@mipmap/plus"
fab:fab_colorPressed="@color/primary_dark"/>
</RelativeLayout>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp"
card_view:contentPadding="20dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical" >
<TextView
android:id="@+id/shop_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16dp"
android:textStyle="bold"
android:textColor="@color/primary"/>
<TextView
android:id="@+id/shop_adress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/primary_dark"/>
</LinearLayout>
</android.support.v7.widget.CardView>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="72dp"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingBottom="20dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:id="@+id/shop_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/primary"
android:textSize="16sp"/>
<TextView
android:id="@+id/shop_adress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/accent"
android:textSize="14sp"/>
</RelativeLayout>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="192sp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/descriptionHoraire"
android:elevation="1dp"/>
<TextView
android:id="@+id/shopName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="208dp"
android:textColor="@color/accent"
android:textSize="24sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/shopAdress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopName"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:textColor="@color/primary"
android:textSize="16sp"
android:textStyle="italic"/>
<TextView
android:id="@+id/shopOpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopAdress"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="20sp"
android:textColor="@color/text_dark"
android:textSize="14sp"/>
<TextView
android:id="@+id/shopStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopOpen"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="8sp"
android:textColor="@color/text_dark"/>
<LinearLayout
android:id="@+id/imageStatus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopStatus"
android:layout_marginBottom="16sp"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="16sp"
android:elevation="1dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/wifi"
android:layout_width="120sp"
android:layout_height="120sp"
android:contentDescription="@string/descriptionWifi"
android:focusable="false"
android:src="@mipmap/wifi"
/>
<ImageView
android:id="@+id/parking"
android:layout_width="120sp"
android:layout_height="120sp"
android:contentDescription="@string/descriptionParking"
android:src="@mipmap/parking"/>
<ImageView
android:id="@+id/handi"
android:layout_width="120sp"
android:layout_height="120sp"
android:contentDescription="@string/descriptionHandi"
android:src="@mipmap/handi"/>
</LinearLayout>
<ImageButton
android:id="@+id/callButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageStatus"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="16sp"
android:layout_marginRight="16sp"
android:contentDescription="@string/descriptionCall"
android:elevation="1dp"
android:src="@mipmap/call"
/>
<ImageButton
android:id="@+id/gpsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/callButton"
android:layout_marginRight="16sp"
android:layout_toLeftOf="@+id/callButton"
android:layout_toStartOf="@+id/callButton"
android:contentDescription="@string/descriptionMap"
android:elevation="1dp"
android:src="@mipmap/map"
/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_create_black_24dp"
fab:fab_colorNormal="@color/accent"
fab:fab_colorPressed="@color/primary_dark"/>
</RelativeLayout>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:scrollbars="vertical"
/>
<TextView
android:id="@+id/empty_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background"
android:gravity="center"
android:textColor="@color/primary"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone"/>
</FrameLayout>

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/background">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="50sp"
android:text="@string/what"
android:textColor="@color/text_dark"
android:textSize="12sp"/>
<EditText
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2"
android:layout_marginBottom="16sp"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="16sp"
android:inputType="text"
android:singleLine="true"
android:textColor="@color/text_form_search"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/name"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="50sp"
android:text="@string/where"
android:textColor="@color/text_dark"/>
<EditText
android:id="@+id/location"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView3"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="16sp"
android:ems="10"
android:inputType="textPostalAddress"
android:singleLine="true"
android:textColor="@color/text_form_search"/>
<Button
android:id="@+id/searchAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/location"
android:layout_marginLeft="16sp"
android:layout_marginTop="73dp"
android:text="@string/find"
android:textColor="@color/accent"/>
<ImageButton
android:id="@+id/gpsAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/searchAction"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginRight="16sp"
android:contentDescription="@string/descriptionButtonGps"
android:src="@android:drawable/ic_menu_compass"
/>
<RelativeLayout
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:elevation="1dp"
android:orientation="horizontal"
android:visibility="gone">
<com.pnikosis.materialishprogress.ProgressWheel
android:id="@+id/progress_wheel"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
wheel:matProg_barColor="@color/progressWheelColor"
wheel:matProg_progressIndeterminate="true"/>
</RelativeLayout>
</RelativeLayout>

View File

@ -0,0 +1,63 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background"
tools:context="${relativePackage}.${activSityClass}">
<ListView
android:id="@+id/horaires_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/button"
android:background="@color/background"
android:clickable="true"
android:focusable="true"
android:scrollbars="vertical"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_alarm_add_black_24dp"
fab:fab_colorNormal="@color/accent"
fab:fab_colorPressed="@color/primary_dark"
tools:ignore="RelativeOverlap"/>
<Button
android:id="@+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/save"
android:textColor="@color/accent"/>
<RelativeLayout
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:elevation="1dp"
android:orientation="horizontal"
android:visibility="gone">
<com.pnikosis.materialishprogress.ProgressWheel
android:id="@+id/progress_wheel"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
wheel:matProg_barColor="@color/progressWheelColor"
wheel:matProg_progressIndeterminate="true"/>
</RelativeLayout>
</RelativeLayout>

View File

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="192sp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/descriptionHoraire"
android:elevation="1dp"/>
<TextView
android:id="@+id/shopName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="208dp"
android:textColor="@color/accent"
android:textSize="24sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/shopAdress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopName"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:textColor="@color/primary"
android:textSize="16sp"
android:textStyle="italic"/>
<TextView
android:id="@+id/shopOpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopAdress"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="20sp"
android:textColor="@color/text_dark"
android:textSize="14sp"/>
<TextView
android:id="@+id/shopStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopOpen"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="8sp"
android:textColor="@color/text_dark"/>
<LinearLayout
android:id="@+id/imageStatus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shopStatus"
android:layout_marginBottom="16sp"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="16sp"
android:elevation="1dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/wifi"
android:layout_width="120sp"
android:layout_height="120sp"
android:contentDescription="@string/descriptionWifi"
android:focusable="false"
android:src="@mipmap/wifi"
/>
<ImageView
android:id="@+id/parking"
android:layout_width="120sp"
android:layout_height="120sp"
android:contentDescription="@string/descriptionParking"
android:src="@mipmap/parking"/>
<ImageView
android:id="@+id/handi"
android:layout_width="120sp"
android:layout_height="120sp"
android:contentDescription="@string/descriptionHandi"
android:src="@mipmap/handi"/>
</LinearLayout>
<ImageButton
android:id="@+id/callButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageStatus"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="16sp"
android:layout_marginRight="16sp"
android:contentDescription="@string/descriptionCall"
android:elevation="1dp"
android:src="@mipmap/call"
/>
<ImageButton
android:id="@+id/gpsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/callButton"
android:layout_marginRight="16sp"
android:layout_toLeftOf="@+id/callButton"
android:layout_toStartOf="@+id/callButton"
android:contentDescription="@string/descriptionMap"
android:elevation="1dp"
android:src="@mipmap/map"
/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_create_black_24dp"
fab:fab_colorNormal="@color/accent"
fab:fab_colorPressed="@color/primary_dark"/>
</RelativeLayout>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="50sp"
android:text="@string/what"
android:textColor="@color/text_dark"
android:textSize="12sp"/>
<EditText
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2"
android:layout_marginBottom="16sp"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="16sp"
android:inputType="text"
android:singleLine="true"
android:textColor="@color/primary_dark"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/name"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="50sp"
android:text="@string/where"
android:textColor="@color/text_dark"/>
<EditText
android:id="@+id/location"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView3"
android:layout_marginLeft="16sp"
android:layout_marginRight="16sp"
android:layout_marginTop="16sp"
android:ems="10"
android:inputType="textPostalAddress"
android:singleLine="true"
android:textColor="@color/primary_dark"/>
<Button
android:id="@+id/searchAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/location"
android:layout_marginLeft="16sp"
android:layout_marginTop="73dp"
android:text="@string/find"
android:textColor="@color/accent"/>
<ImageButton
android:id="@+id/gpsAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/searchAction"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginRight="16sp"
android:contentDescription="@string/descriptionButtonGps"
android:src="@android:drawable/ic_menu_compass"
/>
<RelativeLayout
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:elevation="1dp"
android:orientation="horizontal"
android:visibility="gone">
<com.pnikosis.materialishprogress.ProgressWheel
android:id="@+id/progress_wheel"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
wheel:matProg_barColor="@color/progressWheelColor"
wheel:matProg_progressIndeterminate="true"/>
</RelativeLayout>
</RelativeLayout>

View File

@ -7,4 +7,5 @@
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:background="@color/background"
android:textColor="@color/text_dark"/>

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="72sp"
android:background="#ffffff"
android:background="@color/background"
android:gravity="center_vertical|center|center_horizontal"
android:orientation="horizontal">
@ -22,6 +22,7 @@
android:layout_weight=".3"
android:clickable="true"
android:ems="10"
android:background="@color/background"
android:gravity="center_vertical|center_horizontal"
android:textColor="@color/text_dark"/>
@ -32,6 +33,7 @@
android:layout_weight=".3"
android:clickable="true"
android:ems="10"
android:background="@color/background"
android:gravity="center_vertical|center_horizontal"
android:textAlignment="center"
android:textColor="@color/text_dark"/>

View File

@ -1,63 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background"
tools:context="${relativePackage}.${activSityClass}">
<ListView
android:id="@+id/horaires_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/button"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:scrollbars="vertical"/>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@mipmap/ic_alarm_add_black_24dp"
fab:fab_colorNormal="@color/accent"
fab:fab_colorPressed="@color/primary_dark"
tools:ignore="RelativeOverlap"/>
<Button
android:id="@+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/save"
android:textColor="@color/accent"/>
<RelativeLayout
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:elevation="1dp"
android:orientation="horizontal"
android:visibility="gone">
<com.pnikosis.materialishprogress.ProgressWheel
android:id="@+id/progress_wheel"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
wheel:matProg_barColor="@color/progressWheelColor"
wheel:matProg_progressIndeterminate="true"/>
</RelativeLayout>
</RelativeLayout>

View File

@ -26,7 +26,7 @@
<string name="changelog_ok_button">OK</string>
<string name="changelog_show_full">Plus…</string>
<string name="contact">Contacter le dev</string>
<string name="time_slot_error">Merci d'utiliser des tranches de 5 minutes maximum</string>
<string name="time_slot_error">Merci d\'utiliser des tranches de 5 minutes maximum</string>
<string name="success_update_shop">Mise à jour effectuée!</string>
<string name="fail_localize_user">Petit soucis lors de la localisation</string>
<string-array name="days_arrays">

View File

@ -25,9 +25,12 @@
<string name="changelog_ok_button">OK</string>
<string name="changelog_show_full">Plus…</string>
<string name="contact">Contacter le dev</string>
<string name="time_slot_error">Merci d'utiliser des tranches de 5 minutes maximum</string>
<string name="time_slot_error">Merci d\'utiliser des tranches de 5 minutes maximum</string>
<string name="success_update_shop">Mise à jour effectuée!</string>
<string name="resultatRechercheVide">Aucun résultat n\'a été trouvé</string>
<string name="fail_localize_user">Petit soucis lors de la localisation</string>
<string name="fail_fill_form">Oops. Préciser ce que vous rechercher d\'abord</string>
<string name="fail_connexion">Oops. Aucune connexion à internet. Utilisez vos favoris</string>
<string-array name="days_arrays">
<item>Lundi</item>
<item>Mardi</item>

View File

@ -25,6 +25,9 @@
<color name="accent">#ffab00</color>
<color name="text_primary">#FFFFFF</color>
<color name="text_dark">#000000</color>
<color name="text_card">#000000</color>
<color name="text_form_search">#9c27b0</color>
<color name="text_white">#FFFFFF</color>
<color name="background">#EEEEEE</color>
<color name="progressWheelColor">#5588FF</color>
</resources>