19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/anim/bounce.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
24 |
25 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/anim/bounce2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
24 |
25 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
16 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/anim/bounce_heart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
24 |
25 |
--------------------------------------------------------------------------------
/BeaconNotifier/android-ago/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/android-ago/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/BeaconNotifier/libs/android-ago/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/BeaconNotifier/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/BeaconNotifier/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/BeaconNotifier/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Android API 18 Platform
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/bundles/debug/R.txt:
--------------------------------------------------------------------------------
1 | int attr column_count 0x7f010000
2 | int attr column_count_landscape 0x7f010002
3 | int attr column_count_portrait 0x7f010001
4 | int attr grid_paddingBottom 0x7f010007
5 | int attr grid_paddingLeft 0x7f010004
6 | int attr grid_paddingRight 0x7f010005
7 | int attr grid_paddingTop 0x7f010006
8 | int attr item_margin 0x7f010003
9 | int[] styleable StaggeredGridView { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007 }
10 | int styleable StaggeredGridView_column_count 0
11 | int styleable StaggeredGridView_column_count_landscape 2
12 | int styleable StaggeredGridView_column_count_portrait 1
13 | int styleable StaggeredGridView_grid_paddingBottom 7
14 | int styleable StaggeredGridView_grid_paddingLeft 4
15 | int styleable StaggeredGridView_grid_paddingRight 5
16 | int styleable StaggeredGridView_grid_paddingTop 6
17 | int styleable StaggeredGridView_item_margin 3
18 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/bundles/release/R.txt:
--------------------------------------------------------------------------------
1 | int attr column_count 0x7f010000
2 | int attr column_count_landscape 0x7f010002
3 | int attr column_count_portrait 0x7f010001
4 | int attr grid_paddingBottom 0x7f010007
5 | int attr grid_paddingLeft 0x7f010004
6 | int attr grid_paddingRight 0x7f010005
7 | int attr grid_paddingTop 0x7f010006
8 | int attr item_margin 0x7f010003
9 | int[] styleable StaggeredGridView { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007 }
10 | int styleable StaggeredGridView_column_count 0
11 | int styleable StaggeredGridView_column_count_landscape 2
12 | int styleable StaggeredGridView_column_count_portrait 1
13 | int styleable StaggeredGridView_grid_paddingBottom 7
14 | int styleable StaggeredGridView_grid_paddingLeft 4
15 | int styleable StaggeredGridView_grid_paddingRight 5
16 | int styleable StaggeredGridView_grid_paddingTop 6
17 | int styleable StaggeredGridView_item_margin 3
18 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/symbols/test/debug/R.txt:
--------------------------------------------------------------------------------
1 | int attr column_count 0x7f010000
2 | int attr column_count_landscape 0x7f010002
3 | int attr column_count_portrait 0x7f010001
4 | int attr grid_paddingBottom 0x7f010007
5 | int attr grid_paddingLeft 0x7f010004
6 | int attr grid_paddingRight 0x7f010005
7 | int attr grid_paddingTop 0x7f010006
8 | int attr item_margin 0x7f010003
9 | int[] styleable StaggeredGridView { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007 }
10 | int styleable StaggeredGridView_column_count 0
11 | int styleable StaggeredGridView_column_count_landscape 2
12 | int styleable StaggeredGridView_column_count_portrait 1
13 | int styleable StaggeredGridView_grid_paddingBottom 7
14 | int styleable StaggeredGridView_grid_paddingLeft 4
15 | int styleable StaggeredGridView_grid_paddingRight 5
16 | int styleable StaggeredGridView_grid_paddingTop 6
17 | int styleable StaggeredGridView_item_margin 3
18 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/horizontal_separator.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/preferences/Prefs.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.preferences;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * ** Created by julien on 23/02/15.
8 | */
9 | public class Prefs {
10 | // public static final String[] PREFS_FILER_LIST = {
11 | // "Musées", "Ville", "Magasins", "Historique", "Aéroports", "Entreprises", "Non classés" };
12 | public static String BEACON_FILTER = "beacon_filter";
13 |
14 | private List mPreferenceFilterBeaconList;
15 |
16 | public void setPreferenceFilterBeaconList(List mPreferenceFilterBeaconList) {
17 | this.mPreferenceFilterBeaconList = mPreferenceFilterBeaconList;
18 | }
19 |
20 | public List getPreferenceFilterBeaconList() {
21 | return mPreferenceFilterBeaconList;
22 | }
23 |
24 | public static class PreferenceFilterBeacon implements Serializable {
25 | public String Title;
26 | public boolean Checked;
27 | }
28 | }
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/android-ago/build/generated/source/r/test/debug/com/github/curioustechizen/ago/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 | package com.github.curioustechizen.ago;
8 |
9 | public final class R {
10 | public static final class attr {
11 | public static final int reference_time = 0x7f010002;
12 | public static final int relative_time_prefix = 0x7f010000;
13 | public static final int relative_time_suffix = 0x7f010001;
14 | }
15 | public static final class string {
16 | public static final int just_now = 0x7f020000;
17 | }
18 | public static final class styleable {
19 | public static final int[] RelativeTimeTextView = { 0x7f010000, 0x7f010001, 0x7f010002 };
20 | public static final int RelativeTimeTextView_reference_time = 2;
21 | public static final int RelativeTimeTextView_relative_time_prefix = 0;
22 | public static final int RelativeTimeTextView_relative_time_suffix = 1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/popup_history_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | BlueWave-Android
2 | ================
3 |
4 | [](http://www.youtube.com/watch?v=Bt5OSYRqDeQ)
5 |
6 | ##[BlueWave iOS link](http://github.com/juliengenoud/bluewave-ios)
7 |
8 |
9 | Cette application a pour but de promouvoir et/ou présenter un produit à courte proximité à l'aide de la nouvelle technologie Bluetooth Low Energy, des balises bluetooth (http://store.gimbal.com/collections/beacons/products/s10) et de la librairie Altbeacon (https://github.com/AltBeacon/android-beacon-library).
10 |
11 | Un BackEnd web a été développé en parallèle permettant aux professionnels de configurer leurs balises.
12 | Application principalement dédiée aux commerçants, aux musées mais aussi
13 | au service public.
14 |
15 | Page de présentation : http://notiwave.com
16 |
17 | Vidéo de présentation : http://www.youtube.com/watch?v=Bt5OSYRqDeQ
18 |
19 | Screenshots :
20 |
21 | 
22 |
23 | 
24 |
25 | 
26 |
27 | 
28 |
29 | 
30 |
31 | 
32 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/item_history_search.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/view_loading_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
19 |
20 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/service/PullBeaconService.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.service;
2 |
3 | import android.content.Intent;
4 | import android.util.Log;
5 |
6 | import com.commonsware.cwac.wakeful.WakefulIntentService;
7 |
8 | import debas.com.beaconnotifier.AsyncTaskDB;
9 | import debas.com.beaconnotifier.database.BeaconDataBase;
10 |
11 | /**
12 | * Created by debas on 15/10/14.
13 | */
14 | public class PullBeaconService extends WakefulIntentService {
15 |
16 | public PullBeaconService() {
17 | super("PullBeaconService");
18 | }
19 |
20 | @Override
21 | protected void doWakefulWork(Intent intent) {
22 | Log.d("PullBeaconService", "updating");
23 |
24 | BeaconDataBase mBeaconDataBase = BeaconDataBase.getInstance(getApplicationContext());
25 | mBeaconDataBase.updateDB(getApplicationContext(), new AsyncTaskDB.OnDBUpdated() {
26 | @Override
27 | public void onDBUpdated(boolean result, int nbElement) {
28 | if (!result) {
29 | Log.d("PullBeaconService", "failed to update DB");
30 | } else {
31 | Log.d("PullBeaconService", "success to update DB : new element " + nbElement);
32 | }
33 | }
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F4D52
4 | #FF5D52
5 | #FF3D52
6 | #000000
7 | #10797E
8 | #10697E
9 | #55d5d5d5
10 | #85c2be
11 | #ff509f9b
12 | #FFF
13 |
14 | #38FFFFFF
15 | #FF0C5255
16 |
17 | #B2000000
18 | #E5E5E5
19 | #808080
20 | #FAFAFA
21 | #F1F1F1
22 | #e91e63
23 | #ec407a
24 | #805677fc
25 | #80738ffe
26 |
27 |
28 | #6000
29 | #ff0e6669
30 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/BroadCastBluetoothReceiver.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier;
2 |
3 | import android.bluetooth.BluetoothAdapter;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * Created by debas on 03/03/15.
13 | */
14 |
15 | public class BroadCastBluetoothReceiver extends BroadcastReceiver {
16 |
17 | private List mBroadCastBluetoothListeners = new ArrayList<>();
18 |
19 | @Override
20 | public void onReceive(Context context, Intent intent) {
21 | final String action = intent.getAction();
22 |
23 | if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
24 | int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
25 | for (BroadCastBluetoothListener b : mBroadCastBluetoothListeners) {
26 | b.onChange(state);
27 | }
28 | }
29 | }
30 |
31 | public void addBroadCastBluetoothListner(BroadCastBluetoothListener broadCastBluetoothListener) {
32 | mBroadCastBluetoothListeners.add(broadCastBluetoothListener);
33 | }
34 |
35 | public interface BroadCastBluetoothListener {
36 | public void onChange(int state);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/model/BeaconItemDB.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.model;
2 |
3 | import com.google.gson.JsonArray;
4 | import com.orm.SugarRecord;
5 |
6 | import org.altbeacon.beacon.Beacon;
7 |
8 | import java.io.Serializable;
9 |
10 | /**
11 | * Created by debas on 21/10/14.
12 | */
13 |
14 | public class BeaconItemDB extends SugarRecord implements Serializable {
15 |
16 | public String mUuid = "";
17 | public String mNotification = "";
18 | public String mTitle = "";
19 | public String mSerial = "";
20 |
21 | public int mMajor = 0;
22 | public int mMinor = 0;
23 | public int mRange = 0;
24 |
25 | public BeaconItemDB() {
26 |
27 | }
28 |
29 | public BeaconItemDB(JsonArray jsonArray) {
30 | mSerial = jsonArray.get(0).getAsString();
31 | mUuid = jsonArray.get(1).getAsString().toLowerCase();
32 | mMajor = jsonArray.get(2).getAsInt();
33 | mMinor = jsonArray.get(3).getAsInt();
34 | mNotification = jsonArray.get(4).getAsString();
35 | mRange = jsonArray.get(5).getAsInt();
36 | mTitle = jsonArray.get(6).getAsString();
37 | }
38 |
39 | public boolean compare(Beacon beacon) {
40 | return (mUuid.equalsIgnoreCase(beacon.getId1().toUuidString())
41 | && mMajor == beacon.getId2().toInt()
42 | && mMinor == beacon.getId3().toInt());
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/TypefacedTextView.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Typeface;
6 | import android.util.AttributeSet;
7 | import android.widget.TextView;
8 |
9 | /**
10 | * Created by debas on 17/02/15.
11 | */
12 | public class TypefacedTextView extends TextView
13 | {
14 |
15 | public TypefacedTextView(Context context, AttributeSet attrs)
16 | {
17 |
18 | super(context, attrs);
19 |
20 | if (attrs != null)
21 | {
22 | // Get Custom Attribute Name and value
23 | TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.TypefacedTextView);
24 | System.out.println(styledAttrs.toString());
25 |
26 | int typefaceCode = styledAttrs.getInt(R.styleable.TypefacedTextView_fontStyle, -1);
27 | styledAttrs.recycle();
28 |
29 | // Typeface.createFromAsset doesn't work in the layout editor.
30 | // Skipping...
31 | if (isInEditMode())
32 | {
33 | return;
34 | }
35 | Typeface typeface = TypefaceCache.get(context.getAssets(), typefaceCode);
36 | setTypeface(typeface);
37 | }
38 | }
39 |
40 | public TypefacedTextView(Context context)
41 | {
42 | super(context);
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/src/main/java/com/etsy/android/grid/util/DynamicHeightImageView.java:
--------------------------------------------------------------------------------
1 | package com.etsy.android.grid.util;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * An {@link android.widget.ImageView} layout that maintains a consistent width to height aspect ratio.
9 | */
10 | public class DynamicHeightImageView extends ImageView {
11 |
12 | private double mHeightRatio;
13 |
14 | public DynamicHeightImageView(Context context, AttributeSet attrs) {
15 | super(context, attrs);
16 | }
17 |
18 | public DynamicHeightImageView(Context context) {
19 | super(context);
20 | }
21 |
22 | public void setHeightRatio(double ratio) {
23 | if (ratio != mHeightRatio) {
24 | mHeightRatio = ratio;
25 | requestLayout();
26 | }
27 | }
28 |
29 | public double getHeightRatio() {
30 | return mHeightRatio;
31 | }
32 |
33 | @Override
34 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
35 | if (mHeightRatio > 0.0) {
36 | // set the image views size
37 | int width = MeasureSpec.getSize(widthMeasureSpec);
38 | int height = (int) (width * mHeightRatio);
39 | setMeasuredDimension(width, height);
40 | }
41 | else {
42 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/preferences/CheckableLinearLayout.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.preferences;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.Checkable;
6 | import android.widget.LinearLayout;
7 |
8 | /**
9 | * ** Created by julien on 23/02/15.
10 | */
11 | public class CheckableLinearLayout extends LinearLayout implements Checkable {
12 | private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
13 |
14 | private boolean mChecked = false;
15 |
16 | public CheckableLinearLayout(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public boolean isChecked() {
21 | return mChecked;
22 | }
23 |
24 | public void setChecked(boolean b) {
25 | if (b != mChecked) {
26 | mChecked = b;
27 | refreshDrawableState();
28 | }
29 | }
30 |
31 | public void toggle() {
32 | setChecked(!mChecked);
33 | }
34 |
35 | @Override
36 | public int[] onCreateDrawableState(int extraSpace) {
37 | final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
38 | if (isChecked()) {
39 | mergeDrawableStates(drawableState, CHECKED_STATE_SET);
40 | }
41 | return drawableState;
42 | }
43 |
44 | @Override
45 | public boolean performClick() {
46 | toggle();
47 | return super.performClick();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/TypefaceCache.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier;
2 |
3 | import android.content.res.AssetManager;
4 | import android.graphics.Typeface;
5 |
6 | import java.util.Hashtable;
7 |
8 | /**
9 | * Created by debas on 17/02/15.
10 | */
11 | public class TypefaceCache {
12 |
13 | private static final Hashtable CACHE = new Hashtable();
14 |
15 | private static final String COND_BOLD = "fonts/DINPro-Black.otf";
16 | private static final String COND_LIGHT = "fonts/DINPro-Medium.otf";
17 | private static final String COND_LIGHT_ITALIC = "fonts/OpenSans-CondLightItalic.ttf";
18 |
19 | public static Typeface get(AssetManager manager, int typefaceCode) {
20 | synchronized (CACHE) {
21 |
22 | String typefaceName = getTypefaceName(typefaceCode);
23 |
24 | if (!CACHE.containsKey(typefaceName)) {
25 | Typeface t = Typeface.createFromAsset(manager, typefaceName);
26 | CACHE.put(typefaceName, t);
27 | }
28 | return CACHE.get(typefaceName);
29 | }
30 | }
31 |
32 | private static String getTypefaceName(int typefaceCode) {
33 | switch (typefaceCode) {
34 | case 0:
35 | return COND_LIGHT;
36 |
37 | case 1:
38 | return COND_LIGHT_ITALIC;
39 |
40 | case 2:
41 | return COND_BOLD;
42 |
43 | default:
44 | return null;
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/src/main/java/com/etsy/android/grid/util/DynamicHeightTextView.java:
--------------------------------------------------------------------------------
1 | package com.etsy.android.grid.util;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.TextView;
6 |
7 | /**
8 | *
9 | * A {@link android.widget.TextView} that maintains a consistent width to height aspect ratio.
10 | * In the real world this would likely extend ImageView.
11 | */
12 | public class DynamicHeightTextView extends TextView {
13 |
14 | private double mHeightRatio;
15 |
16 | public DynamicHeightTextView(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public DynamicHeightTextView(Context context) {
21 | super(context);
22 | }
23 |
24 | public void setHeightRatio(double ratio) {
25 | if (ratio != mHeightRatio) {
26 | mHeightRatio = ratio;
27 | requestLayout();
28 | }
29 | }
30 |
31 | public double getHeightRatio() {
32 | return mHeightRatio;
33 | }
34 |
35 | @Override
36 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
37 | if (mHeightRatio > 0.0) {
38 | // set the image views size
39 | int width = MeasureSpec.getSize(widthMeasureSpec);
40 | int height = (int) (width * mHeightRatio);
41 | setMeasuredDimension(width, height);
42 | }
43 | else {
44 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/aidl/android/support/v4/app/INotificationSideChannel.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.support.v4.app;
18 |
19 | import android.app.Notification;
20 |
21 | /**
22 | * Interface used for delivering notifications via a side channel that bypasses
23 | * the NotificationManagerService.
24 | *
25 | * @hide
26 | */
27 | oneway interface INotificationSideChannel {
28 | /**
29 | * Send an ambient notification to the service.
30 | */
31 | void notify(String packageName, int id, String tag, in Notification notification);
32 |
33 | /**
34 | * Cancel an already-notified notification.
35 | */
36 | void cancel(String packageName, int id, String tag);
37 |
38 | /**
39 | * Cancel all notifications for the given package.
40 | */
41 | void cancelAll(String packageName);
42 | }
43 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/adapter/SimpleRecyclerAdapter.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import java.util.ArrayList;
11 |
12 | /**
13 | * Created by debas on 20/02/15.
14 | */
15 | public class SimpleRecyclerAdapter extends RecyclerView.Adapter {
16 | private LayoutInflater mInflater;
17 | private ArrayList mItems;
18 |
19 | public SimpleRecyclerAdapter(Context context, ArrayList items) {
20 | mInflater = LayoutInflater.from(context);
21 | mItems = items;
22 | }
23 |
24 | @Override
25 | public int getItemCount() {
26 | return mItems.size();
27 | }
28 |
29 | @Override
30 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
31 | return new ViewHolder(mInflater.inflate(android.R.layout.simple_list_item_1, parent, false));
32 | }
33 |
34 | @Override
35 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
36 | viewHolder.textView.setText(mItems.get(position));
37 | }
38 |
39 | static class ViewHolder extends RecyclerView.ViewHolder {
40 | TextView textView;
41 |
42 | public ViewHolder(View view) {
43 | super(view);
44 | textView = (TextView) view.findViewById(android.R.id.text1);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/android-ago/build/intermediates/incremental/mergeResources/test/debug/merger.xml:
--------------------------------------------------------------------------------
1 |
2 | Just Nowà l\'instant
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/generated/source/r/test/debug/com/etsy/android/grid/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 | package com.etsy.android.grid;
8 |
9 | public final class R {
10 | public static final class attr {
11 | public static final int column_count = 0x7f010000;
12 | public static final int column_count_landscape = 0x7f010002;
13 | public static final int column_count_portrait = 0x7f010001;
14 | public static final int grid_paddingBottom = 0x7f010007;
15 | public static final int grid_paddingLeft = 0x7f010004;
16 | public static final int grid_paddingRight = 0x7f010005;
17 | public static final int grid_paddingTop = 0x7f010006;
18 | public static final int item_margin = 0x7f010003;
19 | }
20 | public static final class styleable {
21 | public static final int[] StaggeredGridView = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007 };
22 | public static final int StaggeredGridView_column_count = 0;
23 | public static final int StaggeredGridView_column_count_landscape = 2;
24 | public static final int StaggeredGridView_column_count_portrait = 1;
25 | public static final int StaggeredGridView_grid_paddingBottom = 7;
26 | public static final int StaggeredGridView_grid_paddingLeft = 4;
27 | public static final int StaggeredGridView_grid_paddingRight = 5;
28 | public static final int StaggeredGridView_grid_paddingTop = 6;
29 | public static final int StaggeredGridView_item_margin = 3;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/adapter/SearchViewAdapter.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.adapter;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.support.v4.widget.CursorAdapter;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import debas.com.beaconnotifier.R;
13 | import debas.com.beaconnotifier.model.BeaconItemSeen;
14 | import debas.com.beaconnotifier.utils.Utils;
15 |
16 | /**
17 | * Created by debas on 23/02/15.
18 | */
19 | public class SearchViewAdapter extends CursorAdapter {
20 |
21 | public SearchViewAdapter(Context context) {
22 | super(context, null, false);
23 | }
24 |
25 |
26 | @Override
27 | public View newView(Context context, Cursor cursor, ViewGroup parent) {
28 | return LayoutInflater.from(context).inflate(R.layout.item_history_search, parent, false);
29 | }
30 |
31 | @Override
32 | public void bindView(View view, final Context context, final Cursor cursor) {
33 | if (cursor != null && !cursor.isClosed()) {
34 | BeaconItemSeen beaconItemSeen = BeaconItemSeen.fromCursor(cursor);
35 |
36 | ImageView imageView = (ImageView) view.findViewById(R.id.imageview_search);
37 | imageView.setImageResource(Utils.getAssociatedImage(beaconItemSeen.mMajor, beaconItemSeen.mMinor));
38 | TextView textView = (TextView) view.findViewById(R.id.item);
39 | textView.setText(beaconItemSeen.mNotification);
40 | }
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/android-ago/build/intermediates/incremental/packageResources/debug/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Just Nowà l\'instant
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/android-ago/build/intermediates/incremental/packageResources/release/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Just Nowà l\'instant
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/incremental/packageResources/debug/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/incremental/packageResources/release/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "21.1.2"
6 |
7 | repositories {
8 | mavenCentral()
9 | maven {
10 | url 'http://dl.bintray.com/amulyakhare/maven'
11 | }
12 | maven {
13 | url "https://repo.commonsware.com.s3.amazonaws.com"
14 | }
15 | }
16 |
17 | defaultConfig {
18 | applicationId "debas.com.beaconnotifier"
19 | minSdkVersion 16
20 | targetSdkVersion 21
21 | versionCode 1
22 | versionName "1.0"
23 | }
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | }
31 | repositories {
32 | mavenCentral()
33 | flatDir {
34 | dirs 'libs'
35 | }
36 | }
37 |
38 | dependencies {
39 | compile fileTree(dir: 'libs', include: ['*.jar'])
40 | compile 'de.hdodenhof:circleimageview:1.2.2'
41 | compile 'org.altbeacon:android-beacon-library:2.1.3'
42 | compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
43 | compile 'com.koushikdutta.ion:ion:2.0.8'
44 | compile 'com.github.satyan:sugar:1.3'
45 | compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
46 | compile 'com.getbase:floatingactionbutton:1.8.0'
47 | compile 'com.android.support:appcompat-v7:21.0.3'
48 | compile 'com.android.support:cardview-v7:21.0.0'
49 | compile 'com.shamanland:fab:0.0.8'
50 | compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
51 | compile 'com.commonsware.cwac:wakeful:1.0.5'
52 | compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
53 | compile 'com.afollestad:material-dialogs:0.6.3.3'
54 | compile files('libs/cwac-wakeful-1.0.3.jar')
55 | compile project(':app:libs:android-ago')
56 | compile project(':app:libs:AndroidStaggeredGrid')
57 | }
58 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
22 |
33 |
34 |
45 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/incremental/mergeResources/test/debug/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/incremental/mergeResources/debug/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/libs/AndroidStaggeredGrid/build/intermediates/incremental/mergeResources/release/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.utils;
2 |
3 | import android.bluetooth.BluetoothAdapter;
4 | import android.content.Context;
5 | import android.net.ConnectivityManager;
6 | import android.net.NetworkInfo;
7 |
8 | import debas.com.beaconnotifier.BroadCastBluetoothReceiver;
9 | import debas.com.beaconnotifier.R;
10 |
11 | /**
12 | * Created by debas on 21/10/14.
13 | */
14 | public class Utils {
15 |
16 | private static BroadCastBluetoothReceiver mBroadCastBluetoothReceiver = new BroadCastBluetoothReceiver();
17 |
18 | public static boolean checkInternetConnectivity(Context context) {
19 | ConnectivityManager cm = (ConnectivityManager) context
20 | .getSystemService(Context.CONNECTIVITY_SERVICE);
21 | NetworkInfo netInfo = cm.getActiveNetworkInfo();
22 |
23 | // only when connected or while connecting...
24 | if (netInfo != null && netInfo.isConnectedOrConnecting() &&
25 | ((netInfo.getType() == ConnectivityManager.TYPE_MOBILE) || (netInfo.getType() == ConnectivityManager.TYPE_WIFI))) {
26 | return true;
27 | } else {
28 | return false;
29 | }
30 | }
31 |
32 | public static void changeBluetoothState(boolean bool) {
33 | BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
34 | if (bool && !mBluetoothAdapter.isEnabled()) {
35 | mBluetoothAdapter.enable();
36 | }
37 | if (!bool && mBluetoothAdapter.isEnabled()) {
38 | mBluetoothAdapter.disable();
39 | }
40 | }
41 |
42 | public static boolean getBluetoothState() {
43 | BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
44 | return mBluetoothAdapter.isEnabled();
45 | }
46 |
47 | public static BroadCastBluetoothReceiver getBroadCastBluetoothReceiver() {
48 | return mBroadCastBluetoothReceiver;
49 | }
50 |
51 | public static int getAssociatedImage(int major, int minor) {
52 | if (major == 36 && minor == 55)
53 | return R.drawable.eglise;
54 | else if (major == 65 && minor == 12)
55 | return R.drawable.tableau;
56 | return R.drawable.def;
57 | };
58 | }
59 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/activity_viewpagertab.xml:
--------------------------------------------------------------------------------
1 |
13 |
18 |
19 |
23 |
24 |
28 |
29 |
30 |
36 |
37 |
45 |
46 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/adapter/SimpleHeaderRecyclerAdapter.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import java.util.ArrayList;
11 |
12 | /**
13 | * Created by debas on 20/02/15.
14 | */
15 | public class SimpleHeaderRecyclerAdapter extends RecyclerView.Adapter {
16 | private static final int VIEW_TYPE_HEADER = 0;
17 | private static final int VIEW_TYPE_ITEM = 1;
18 |
19 | private LayoutInflater mInflater;
20 | private ArrayList mItems;
21 | private View mHeaderView;
22 |
23 | public SimpleHeaderRecyclerAdapter(Context context, ArrayList items, View headerView) {
24 | mInflater = LayoutInflater.from(context);
25 | mItems = items;
26 | mHeaderView = headerView;
27 | }
28 |
29 | @Override
30 | public int getItemCount() {
31 | if (mHeaderView == null) {
32 | return mItems.size();
33 | } else {
34 | return mItems.size() + 1;
35 | }
36 | }
37 |
38 | @Override
39 | public int getItemViewType(int position) {
40 | return (position == 0) ? VIEW_TYPE_HEADER : VIEW_TYPE_ITEM;
41 | }
42 |
43 | @Override
44 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
45 | if (viewType == VIEW_TYPE_HEADER) {
46 | return new HeaderViewHolder(mHeaderView);
47 | } else {
48 | return new ItemViewHolder(mInflater.inflate(android.R.layout.simple_list_item_1, parent, false));
49 | }
50 | }
51 |
52 | @Override
53 | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
54 | if (viewHolder instanceof ItemViewHolder) {
55 | ((ItemViewHolder) viewHolder).textView.setText(mItems.get(position - 1));
56 | }
57 | }
58 |
59 | static class HeaderViewHolder extends RecyclerView.ViewHolder {
60 | public HeaderViewHolder(View view) {
61 | super(view);
62 | }
63 | }
64 |
65 | static class ItemViewHolder extends RecyclerView.ViewHolder {
66 | TextView textView;
67 |
68 | public ItemViewHolder(View view) {
69 | super(view);
70 | textView = (TextView) view.findViewById(android.R.id.text1);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/adapter/HistoryGridAdapter.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.adapter;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.graphics.Paint;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.CursorAdapter;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import com.github.curioustechizen.ago.RelativeTimeTextView;
14 |
15 | import debas.com.beaconnotifier.R;
16 | import debas.com.beaconnotifier.model.BeaconItemSeen;
17 | import debas.com.beaconnotifier.utils.Utils;
18 |
19 | /**
20 | * Created by debas on 28/02/15.
21 | */
22 | public class HistoryGridAdapter extends CursorAdapter {
23 |
24 | private View.OnClickListener mOnClickListner;
25 |
26 | public HistoryGridAdapter(Context context, View.OnClickListener onClickListener) {
27 | super(context, null, false);
28 | this.mOnClickListner = onClickListener;
29 | }
30 |
31 | @Override
32 | public View newView(Context context, Cursor cursor, ViewGroup parent) {
33 | View v = LayoutInflater.from(context).inflate(R.layout.beacon_item_view, null);
34 | // v.setLongClickable(true);
35 | return v;
36 | }
37 |
38 | @Override
39 | public void bindView(View view, Context context, Cursor cursor) {
40 | final BeaconItemSeen beaconItemSeen = BeaconItemSeen.fromCursor(cursor);
41 |
42 | TextView textView = (TextView) view.findViewById(R.id.name_beacon);
43 | RelativeTimeTextView lastTimeSeen = (RelativeTimeTextView) view.findViewById(R.id.last_time_seen);
44 | ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
45 |
46 | imageView.setImageResource(Utils.getAssociatedImage(beaconItemSeen.mMajor, beaconItemSeen.mMinor));
47 | textView.setText(beaconItemSeen.mNotification);
48 | lastTimeSeen.setReferenceTime(beaconItemSeen.mSeen);
49 | textView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
50 |
51 | /* favorites image click */
52 | ImageView favoritesImageView = (ImageView) view.findViewById(R.id.favorites_heart);
53 | favoritesImageView.setImageResource(beaconItemSeen.mFavorites ? R.drawable.favorites_full : R.drawable.favorites_empty);
54 | favoritesImageView.setOnClickListener(mOnClickListner);
55 | favoritesImageView.setTag(beaconItemSeen);
56 | view.setTag(beaconItemSeen);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/beacon_item_view2.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
29 |
30 |
43 |
44 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/res/layout/listitem.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
17 |
18 |
24 |
25 |
30 |
31 |
38 |
39 |
46 |
47 |
54 |
55 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/display/DisplayBeaconAdapter.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.display;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.TextView;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | import debas.com.beaconnotifier.R;
14 | import debas.com.beaconnotifier.model.BeaconItemSeen;
15 |
16 | /**
17 | * Created by debas on 01/10/14.
18 | */
19 | public class DisplayBeaconAdapter extends BaseAdapter {
20 |
21 | private List mBeaconList = null;
22 | private Context mContext = null;
23 | private LayoutInflater mLayoutInflater = null;
24 | private int updated = 0;
25 |
26 | public DisplayBeaconAdapter(Context context) {
27 | mContext = context;
28 | mLayoutInflater = LayoutInflater.from(mContext);
29 | mBeaconList = new ArrayList<>();
30 | mBeaconList.clear();
31 | }
32 |
33 | @Override
34 | public int getCount() {
35 | // TODO Auto-generated method stub
36 | return mBeaconList.size();
37 | }
38 |
39 | @Override
40 | public Object getItem(int arg0) {
41 | // TODO Auto-generated method stub
42 | return mBeaconList.get(arg0);
43 | }
44 |
45 | @Override
46 | public long getItemId(int arg0) {
47 | // TODO Auto-generated method stub
48 | return arg0;
49 | }
50 |
51 | public void setBeaconList(List beacons) {
52 | mBeaconList = beacons;
53 | updated++;
54 | }
55 |
56 | public List getBeaconList() {
57 | return mBeaconList;
58 | }
59 |
60 | @Override
61 | public View getView(int arg0, View arg1, ViewGroup arg2) {
62 |
63 | if(arg1 == null) {
64 | arg1 = mLayoutInflater.inflate(R.layout.listitem, arg2, false);
65 | }
66 |
67 | TextView beacon_UUID = (TextView)arg1.findViewById(R.id.Beacon_UUID);
68 | TextView beacon_Distance = (TextView)arg1.findViewById(R.id.Beacon_Distance);
69 |
70 | if (mBeaconList.size() > arg0) {
71 | BeaconItemSeen beacon = mBeaconList.get(arg0);
72 | beacon_UUID.setText(beacon.mUuid + " - " + beacon.mMajor + " - " + beacon.mMinor);
73 | beacon_Distance.setText(String.format("%.2f meters away", beacon.mDistance) + " - updated : " + updated);
74 | }
75 | return arg1;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/BeaconNotifier/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/utils/JSONParserURL.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.utils;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 | import java.io.InputStreamReader;
7 | import java.io.UnsupportedEncodingException;
8 | import org.apache.http.HttpEntity;
9 | import org.apache.http.HttpResponse;
10 | import org.apache.http.client.ClientProtocolException;
11 | import org.apache.http.client.methods.HttpPost;
12 | import org.apache.http.impl.client.DefaultHttpClient;
13 | import org.json.JSONException;
14 | import org.json.JSONObject;
15 |
16 | import android.os.AsyncTask;
17 | import android.util.Log;
18 |
19 | import debas.com.beaconnotifier.AsyncTaskDB.OnTaskCompleted;
20 |
21 | /**
22 | * Created by debas on 21/10/14.
23 | */
24 |
25 | public class JSONParserURL extends AsyncTask {
26 | private InputStream is = null;
27 | private JSONObject jObj = null;
28 | private String json = "";
29 | private OnTaskCompleted mListener;
30 |
31 | // constructor
32 |
33 | public JSONParserURL(OnTaskCompleted listener) {
34 | mListener = listener;
35 | }
36 |
37 | @Override
38 | protected JSONObject doInBackground(String... url) {
39 | String mUrl = url[0];
40 | try {
41 | // defaultHttpClient
42 | DefaultHttpClient httpClient = new DefaultHttpClient();
43 | HttpPost httpPost = new HttpPost(mUrl);
44 | HttpResponse httpResponse = httpClient.execute(httpPost);
45 | HttpEntity httpEntity = httpResponse.getEntity();
46 | is = httpEntity.getContent();
47 | } catch (UnsupportedEncodingException e) {
48 | e.printStackTrace();
49 | } catch (ClientProtocolException e) {
50 | e.printStackTrace();
51 | } catch (IOException e) {
52 | e.printStackTrace();
53 | }
54 | try {
55 | BufferedReader reader = new BufferedReader(new InputStreamReader(
56 | is, "iso-8859-1"), 8);
57 | StringBuilder sb = new StringBuilder();
58 | String line = null;
59 | while ((line = reader.readLine()) != null) {
60 | sb.append(line + "n");
61 | }
62 | is.close();
63 | json = sb.toString();
64 | } catch (Exception e) {
65 | Log.e("Buffer Error", "Error converting result " + e.toString());
66 | }
67 | // try parse the string to a JSON object
68 | try {
69 | jObj = new JSONObject(json);
70 | } catch (JSONException e) {
71 | Log.e("JSON Parser", "Error parsing data " + e.toString());
72 | }
73 | return jObj;
74 | }
75 |
76 | @Override
77 | public void onPostExecute(JSONObject o){
78 | mListener.onTaskCompleted(o);
79 | }
80 | }
--------------------------------------------------------------------------------
/BeaconNotifier/app/src/main/java/debas/com/beaconnotifier/display/fragment/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package debas.com.beaconnotifier.display.fragment;
2 |
3 | import android.app.Activity;
4 | import android.content.res.TypedArray;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.util.TypedValue;
8 | import android.view.Menu;
9 | import android.view.View;
10 | import android.widget.ArrayAdapter;
11 | import android.widget.GridView;
12 | import android.widget.ListView;
13 |
14 | import java.util.ArrayList;
15 |
16 | import debas.com.beaconnotifier.R;
17 | import debas.com.beaconnotifier.adapter.SimpleHeaderRecyclerAdapter;
18 | import debas.com.beaconnotifier.adapter.SimpleRecyclerAdapter;
19 | import debas.com.beaconnotifier.display.BaseActivity;
20 |
21 | /**
22 | * Created by debas on 20/02/15.
23 | */
24 | public abstract class BaseFragment extends Fragment {
25 | public static ArrayList getDummyData() {
26 | return BaseActivity.getDummyData();
27 | }
28 |
29 | protected int getActionBarSize() {
30 | Activity activity = getActivity();
31 | if (activity == null) {
32 | return 0;
33 | }
34 | TypedValue typedValue = new TypedValue();
35 | int[] textSizeAttr = new int[]{R.attr.actionBarSize};
36 | int indexOfAttrTextSize = 0;
37 | TypedArray a = activity.obtainStyledAttributes(typedValue.data, textSizeAttr);
38 | int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1);
39 | a.recycle();
40 | return actionBarSize;
41 | }
42 |
43 | protected int getScreenHeight() {
44 | Activity activity = getActivity();
45 | if (activity == null) {
46 | return 0;
47 | }
48 | return activity.findViewById(android.R.id.content).getHeight();
49 | }
50 |
51 | protected void setDummyData(ListView listView) {
52 | listView.setAdapter(new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, getDummyData()));
53 | }
54 |
55 | protected void setDummyDataWithHeader(ListView listView, View headerView) {
56 | listView.addHeaderView(headerView);
57 | setDummyData(listView);
58 | }
59 |
60 | protected void setDummyData(GridView gridView) {
61 | gridView.setAdapter(new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, getDummyData()));
62 | }
63 |
64 | protected void setDummyData(RecyclerView recyclerView) {
65 | recyclerView.setAdapter(new SimpleRecyclerAdapter(getActivity(), getDummyData()));
66 | }
67 |
68 | protected void setDummyDataWithHeader(RecyclerView recyclerView, View headerView) {
69 | recyclerView.setAdapter(new SimpleHeaderRecyclerAdapter(getActivity(), getDummyData(), headerView));
70 | }
71 |
72 | public abstract void buildMenu(Menu menu);
73 | }
--------------------------------------------------------------------------------