Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void onTabSelected(@IdRes int tabItemId) {
});
}

private void initUbuduIndoorLocationSdk() {
public void initUbuduIndoorLocationSdk() {
mIndoorLocationSdk = UbuduIndoorLocationSDK.getSharedInstance(getApplicationContext());
mIndoorLocationManager = mIndoorLocationSdk.getIndoorLocationManager();
mIndoorLocationManager.setBeaconScanningStrategy(new ScanningStrategy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class MapFragment extends BaseFragment implements UbuduIndoorLocationDele
private final long TIME_OFFSET = 20L;

private boolean showParticles = false;
private boolean showBeacons = false;
private boolean showUndetectedBeacons = false;
private static String lastLoadingLabelMessage = "";
private boolean isMoving = false;
Expand Down Expand Up @@ -235,7 +234,6 @@ public void beaconsUpdated(List<ILBeacon> beacons) {
if (isCameraMoving) {
return;
}
if (!showBeacons) return;

// changing markers of beacons not present in the new list of beacons
Map<Marker, com.google.android.gms.maps.model.Marker> markersMatchingTag = mMapView.findMarkers(new MarkerSearchPattern().tag(TAG_BEACON_MARKER));
Expand Down Expand Up @@ -509,12 +507,7 @@ public void onClick(View v) {
showParticles = false;
}

if (mSharedPref.getBoolean("show_beacons", false)) {
showBeacons = true;
} else {
hideAllDetectedBeaconMarkers();
showBeacons = false;
}


UbuduMap map = UbuduIndoorLocationSDK.getSharedInstance(getContext()).getIndoorLocationManager().getMap();
UbuduPositionUpdate lastUpdate = UbuduIndoorLocationSDK.getSharedInstance(getContext()).getIndoorLocationManager().getLastPositionUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompatFix;
import android.support.v7.preference.PreferenceGroup;
import android.widget.Toast;

import com.ubudu.ilapp2.MainActivity;
import com.ubudu.ilapp2.R;
import com.ubudu.ilapp2.util.FragmentUtils;
import com.ubudu.ilapp2.util.MyPreferences;
import com.ubudu.indoorlocation.UbuduIndoorLocationSDK;

public class PreferencesFragment extends PreferenceFragmentCompatFix implements SharedPreferences.OnSharedPreferenceChangeListener {
Expand Down Expand Up @@ -42,6 +45,17 @@ public boolean onPreferenceClick(Preference preference) {
}
});

Preference myShowUndetectedBeacons = findPreference("undetected_beacons");
myShowUndetectedBeacons.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {

MyPreferences.setPreferenceBoolean(getContext(), "show_undetected_beacons", (Boolean) newValue);

return preference.isSelectable();
}
});

Preference appVer = findPreference("app_version");
try {
appVer.setSummary(getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0).versionName
Expand All @@ -52,6 +66,17 @@ public boolean onPreferenceClick(Preference preference) {

Preference ilSdkVer = findPreference("indoorlocation_sdk_version");
ilSdkVer.setSummary(UbuduIndoorLocationSDK.getVersion()+" ("+ UbuduIndoorLocationSDK.getVersionCode()+")");

Preference updateSettingsBtn = findPreference("update_settings");
updateSettingsBtn.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {

((MainActivity) getActivity()).initUbuduIndoorLocationSdk();
Toast.makeText(getContext(), "Data downloaded successfully ", Toast.LENGTH_SHORT).show();
FragmentUtils.changeFragment(getActivity() ,new MapFragment(),true);
return true;
}
});
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions sampleapp/ilapp2/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@
<string name="title_undetected_beacons">Show undetected beacons</string>
<string name="summary_undetected_beacons">Always show all beacons of the current map</string>
<string name="map_settings">Map settings</string>
<string name="sync_ubudu_manager">Synchronize with Ubudu Manager</string>


</resources>
3 changes: 3 additions & 0 deletions sampleapp/ilapp2/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<android.support.v7.preference.Preference
android:key="indoorlocation_sdk_version"
android:title="@string/title_indoorlocation_sdk_version" />
<android.support.v7.preference.Preference
android:key="update_settings"
android:title="@string/sync_ubudu_manager" />
</android.support.v7.preference.PreferenceCategory>

</android.support.v7.preference.PreferenceScreen>
8 changes: 3 additions & 5 deletions sampleapp/local.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Users/mgasztold/Library/Android/sdk
#Tue Apr 17 15:05:07 CEST 2018
sdk.dir=/home/amine/Android/Sdk