Commit 37bce1207c69b7d53a0696e34c931bc4c60c8d30

Authored by florian staine
1 parent aeff84be

Add setting activity and Positionning activity

.idea/compiler.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="CompilerConfiguration">
  4 + <resourceExtensions />
  5 + <wildcardResourcePatterns>
  6 + <entry name="!?*.java" />
  7 + <entry name="!?*.form" />
  8 + <entry name="!?*.class" />
  9 + <entry name="!?*.groovy" />
  10 + <entry name="!?*.scala" />
  11 + <entry name="!?*.flex" />
  12 + <entry name="!?*.kt" />
  13 + <entry name="!?*.clj" />
  14 + <entry name="!?*.aj" />
  15 + </wildcardResourcePatterns>
  16 + <annotationProcessing>
  17 + <profile default="true" name="Default" enabled="false">
  18 + <processorPath useClasspath="true" />
  19 + </profile>
  20 + </annotationProcessing>
  21 + </component>
  22 +</project>
0 23 \ No newline at end of file
... ...
.idea/copyright/profiles_settings.xml 0 → 100644
  1 +<component name="CopyrightManager">
  2 + <settings default="" />
  3 +</component>
0 4 \ No newline at end of file
... ...
.idea/misc.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="EntryPointsManager">
  4 + <entry_points version="2.0" />
  5 + </component>
  6 + <component name="NullableNotNullManager">
  7 + <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
  8 + <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
  9 + <option name="myNullables">
  10 + <value>
  11 + <list size="4">
  12 + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
  13 + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
  14 + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
  15 + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
  16 + </list>
  17 + </value>
  18 + </option>
  19 + <option name="myNotNulls">
  20 + <value>
  21 + <list size="4">
  22 + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
  23 + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
  24 + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
  25 + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
  26 + </list>
  27 + </value>
  28 + </option>
  29 + </component>
  30 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
  31 + <output url="file://$PROJECT_DIR$/build/classes" />
  32 + </component>
  33 + <component name="ProjectType">
  34 + <option name="id" value="Android" />
  35 + </component>
  36 +</project>
0 37 \ No newline at end of file
... ...
.idea/modules.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="ProjectModuleManager">
  4 + <modules>
  5 + <module fileurl="file://$PROJECT_DIR$/PositionningApp.iml" filepath="$PROJECT_DIR$/PositionningApp.iml" />
  6 + <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
  7 + </modules>
  8 + </component>
  9 +</project>
0 10 \ No newline at end of file
... ...
.idea/runConfigurations.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="RunConfigurationProducerService">
  4 + <option name="ignoredProducers">
  5 + <set>
  6 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
  7 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
  8 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
  9 + </set>
  10 + </option>
  11 + </component>
  12 +</project>
0 13 \ No newline at end of file
... ...
.idea/vcs.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="VcsDirectoryMappings">
  4 + <mapping directory="$PROJECT_DIR$" vcs="Git" />
  5 + <mapping directory="$PROJECT_DIR$" vcs="Git" />
  6 + </component>
  7 +</project>
0 8 \ No newline at end of file
... ...
app/build.gradle
... ... @@ -10,6 +10,7 @@ android {
10 10 versionCode 1
11 11 versionName "1.0"
12 12 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  13 + vectorDrawables.useSupportLibrary = true
13 14 }
14 15 buildTypes {
15 16 release {
... ... @@ -27,5 +28,7 @@ dependencies {
27 28 compile 'com.android.support:appcompat-v7:25.3.1'
28 29 compile 'com.android.support.constraint:constraint-layout:1.0.2'
29 30 compile 'com.android.support:design:25.3.1'
  31 + compile 'com.android.support:support-v4:25.3.1'
  32 + compile 'com.android.support:support-vector-drawable:25.3.1'
30 33 testCompile 'junit:junit:4.12'
31 34 }
... ...
app/src/main/AndroidManifest.xml
... ... @@ -19,6 +19,15 @@
19 19 <category android:name="android.intent.category.LAUNCHER" />
20 20 </intent-filter>
21 21 </activity>
  22 + <activity
  23 + android:name=".SettingsActivity"
  24 + android:label="@string/title_activity_settings"
  25 + android:parentActivityName=".PositioningActivity" />
  26 + <activity
  27 + android:name=".PositioningActivity"
  28 + android:label="@string/title_activity_positioning"
  29 + android:theme="@style/AppTheme.NoActionBar" >
  30 + </activity>
22 31 </application>
23 32  
24 33 </manifest>
25 34 \ No newline at end of file
... ...
app/src/main/java/fr/utbm/lo53/p2017/positionningapp/AppCompatPreferenceActivity.java 0 → 100644
  1 +package fr.utbm.lo53.p2017.positionningapp;
  2 +
  3 +import android.content.res.Configuration;
  4 +import android.os.Bundle;
  5 +import android.preference.PreferenceActivity;
  6 +import android.support.annotation.LayoutRes;
  7 +import android.support.annotation.Nullable;
  8 +import android.support.v7.app.ActionBar;
  9 +import android.support.v7.app.AppCompatDelegate;
  10 +import android.support.v7.widget.Toolbar;
  11 +import android.view.MenuInflater;
  12 +import android.view.View;
  13 +import android.view.ViewGroup;
  14 +
  15 +/**
  16 + * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
  17 + * to be used with AppCompat.
  18 + */
  19 +public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
  20 +
  21 + private AppCompatDelegate mDelegate;
  22 +
  23 + @Override
  24 + protected void onCreate(Bundle savedInstanceState) {
  25 + getDelegate().installViewFactory();
  26 + getDelegate().onCreate(savedInstanceState);
  27 + super.onCreate(savedInstanceState);
  28 + }
  29 +
  30 + @Override
  31 + protected void onPostCreate(Bundle savedInstanceState) {
  32 + super.onPostCreate(savedInstanceState);
  33 + getDelegate().onPostCreate(savedInstanceState);
  34 + }
  35 +
  36 + public ActionBar getSupportActionBar() {
  37 + return getDelegate().getSupportActionBar();
  38 + }
  39 +
  40 + public void setSupportActionBar(@Nullable Toolbar toolbar) {
  41 + getDelegate().setSupportActionBar(toolbar);
  42 + }
  43 +
  44 + @Override
  45 + public MenuInflater getMenuInflater() {
  46 + return getDelegate().getMenuInflater();
  47 + }
  48 +
  49 + @Override
  50 + public void setContentView(@LayoutRes int layoutResID) {
  51 + getDelegate().setContentView(layoutResID);
  52 + }
  53 +
  54 + @Override
  55 + public void setContentView(View view) {
  56 + getDelegate().setContentView(view);
  57 + }
  58 +
  59 + @Override
  60 + public void setContentView(View view, ViewGroup.LayoutParams params) {
  61 + getDelegate().setContentView(view, params);
  62 + }
  63 +
  64 + @Override
  65 + public void addContentView(View view, ViewGroup.LayoutParams params) {
  66 + getDelegate().addContentView(view, params);
  67 + }
  68 +
  69 + @Override
  70 + protected void onPostResume() {
  71 + super.onPostResume();
  72 + getDelegate().onPostResume();
  73 + }
  74 +
  75 + @Override
  76 + protected void onTitleChanged(CharSequence title, int color) {
  77 + super.onTitleChanged(title, color);
  78 + getDelegate().setTitle(title);
  79 + }
  80 +
  81 + @Override
  82 + public void onConfigurationChanged(Configuration newConfig) {
  83 + super.onConfigurationChanged(newConfig);
  84 + getDelegate().onConfigurationChanged(newConfig);
  85 + }
  86 +
  87 + @Override
  88 + protected void onStop() {
  89 + super.onStop();
  90 + getDelegate().onStop();
  91 + }
  92 +
  93 + @Override
  94 + protected void onDestroy() {
  95 + super.onDestroy();
  96 + getDelegate().onDestroy();
  97 + }
  98 +
  99 + public void invalidateOptionsMenu() {
  100 + getDelegate().invalidateOptionsMenu();
  101 + }
  102 +
  103 + private AppCompatDelegate getDelegate() {
  104 + if (mDelegate == null) {
  105 + mDelegate = AppCompatDelegate.create(this, null);
  106 + }
  107 + return mDelegate;
  108 + }
  109 +}
... ...
app/src/main/java/fr/utbm/lo53/p2017/positionningapp/Calibration.java
1 1 package fr.utbm.lo53.p2017.positionningapp;
2 2  
  3 +import android.content.Intent;
3 4 import android.os.Bundle;
4 5 import android.support.design.widget.FloatingActionButton;
5 6 import android.support.design.widget.Snackbar;
... ... @@ -67,6 +68,13 @@ public class Calibration extends AppCompatActivity {
67 68  
68 69 //noinspection SimplifiableIfStatement
69 70 if (id == R.id.action_settings) {
  71 + Intent intent = new Intent(this, SettingsActivity.class);
  72 + startActivity(intent);
  73 + return true;
  74 + }
  75 + if (id == R.id.bt_open_locate_activity) {
  76 + Intent intent = new Intent(this, PositioningActivity.class);
  77 + startActivity(intent);
70 78 return true;
71 79 }
72 80  
... ...
app/src/main/java/fr/utbm/lo53/p2017/positionningapp/PositioningActivity.java 0 → 100644
  1 +package fr.utbm.lo53.p2017.positionningapp;
  2 +
  3 +import android.os.Bundle;
  4 +import android.support.design.widget.FloatingActionButton;
  5 +import android.support.design.widget.Snackbar;
  6 +import android.support.v7.app.AppCompatActivity;
  7 +import android.support.v7.widget.Toolbar;
  8 +import android.view.View;
  9 +import android.view.animation.AccelerateInterpolator;
  10 +import android.view.animation.AlphaAnimation;
  11 +import android.view.animation.Animation;
  12 +import android.widget.Button;
  13 +import android.widget.ImageView;
  14 +
  15 +public class PositioningActivity extends AppCompatActivity {
  16 +
  17 + private ImageView alphaBackground;
  18 + private Button buttonStart;
  19 +
  20 + @Override
  21 + protected void onCreate(Bundle savedInstanceState) {
  22 + super.onCreate(savedInstanceState);
  23 + setContentView(R.layout.activity_positioning);
  24 + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  25 + setSupportActionBar(toolbar);
  26 +
  27 + alphaBackground = (ImageView) findViewById(R.id.alpha_background);
  28 + buttonStart = (Button) findViewById(R.id.button_start);
  29 +
  30 + buttonStart.setOnClickListener(new View.OnClickListener() {
  31 + @Override
  32 + public void onClick(View v) {
  33 + fadeOutAndHideImage();
  34 + }
  35 + });
  36 + }
  37 +
  38 + private void fadeOutAndHideImage() {
  39 + Animation fadeOut = new AlphaAnimation(1, 0);
  40 + fadeOut.setInterpolator(new AccelerateInterpolator());
  41 + fadeOut.setDuration(1000);
  42 +
  43 + fadeOut.setAnimationListener(new Animation.AnimationListener() {
  44 + public void onAnimationEnd(Animation animation) {
  45 + alphaBackground.setVisibility(View.GONE);
  46 + buttonStart.setVisibility(View.GONE);
  47 + }
  48 + public void onAnimationRepeat(Animation animation) {}
  49 + public void onAnimationStart(Animation animation) {}
  50 + });
  51 +
  52 + alphaBackground.startAnimation(fadeOut);
  53 + buttonStart.startAnimation(fadeOut);
  54 + }
  55 +}
... ...
app/src/main/java/fr/utbm/lo53/p2017/positionningapp/SettingsActivity.java 0 → 100644
  1 +package fr.utbm.lo53.p2017.positionningapp;
  2 +
  3 +
  4 +import android.annotation.TargetApi;
  5 +import android.content.Context;
  6 +import android.content.Intent;
  7 +import android.content.res.Configuration;
  8 +import android.media.Ringtone;
  9 +import android.media.RingtoneManager;
  10 +import android.net.Uri;
  11 +import android.os.Build;
  12 +import android.os.Bundle;
  13 +import android.preference.ListPreference;
  14 +import android.preference.Preference;
  15 +import android.preference.PreferenceActivity;
  16 +import android.support.v7.app.ActionBar;
  17 +import android.preference.PreferenceFragment;
  18 +import android.preference.PreferenceManager;
  19 +import android.preference.RingtonePreference;
  20 +import android.text.TextUtils;
  21 +import android.view.MenuItem;
  22 +
  23 +import java.util.List;
  24 +
  25 +/**
  26 + * A {@link PreferenceActivity} that presents a set of application settings. On
  27 + * handset devices, settings are presented as a single list. On tablets,
  28 + * settings are split by category, with category headers shown to the left of
  29 + * the list of settings.
  30 + * <p>
  31 + * See <a href="http://developer.android.com/design/patterns/settings.html">
  32 + * Android Design: Settings</a> for design guidelines and the <a
  33 + * href="http://developer.android.com/guide/topics/ui/settings.html">Settings
  34 + * API Guide</a> for more information on developing a Settings UI.
  35 + */
  36 +public class SettingsActivity extends AppCompatPreferenceActivity {
  37 + /**
  38 + * A preference value change listener that updates the preference's summary
  39 + * to reflect its new value.
  40 + */
  41 + private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
  42 + @Override
  43 + public boolean onPreferenceChange(Preference preference, Object value) {
  44 + String stringValue = value.toString();
  45 +
  46 + if (preference instanceof ListPreference) {
  47 + // For list preferences, look up the correct display value in
  48 + // the preference's 'entries' list.
  49 + ListPreference listPreference = (ListPreference) preference;
  50 + int index = listPreference.findIndexOfValue(stringValue);
  51 +
  52 + // Set the summary to reflect the new value.
  53 + preference.setSummary(
  54 + index >= 0
  55 + ? listPreference.getEntries()[index]
  56 + : null);
  57 +
  58 + } else if (preference instanceof RingtonePreference) {
  59 + // For ringtone preferences, look up the correct display value
  60 + // using RingtoneManager.
  61 + if (TextUtils.isEmpty(stringValue)) {
  62 + // Empty values correspond to 'silent' (no ringtone).
  63 + preference.setSummary(R.string.pref_ringtone_silent);
  64 +
  65 + } else {
  66 + Ringtone ringtone = RingtoneManager.getRingtone(
  67 + preference.getContext(), Uri.parse(stringValue));
  68 +
  69 + if (ringtone == null) {
  70 + // Clear the summary if there was a lookup error.
  71 + preference.setSummary(null);
  72 + } else {
  73 + // Set the summary to reflect the new ringtone display
  74 + // name.
  75 + String name = ringtone.getTitle(preference.getContext());
  76 + preference.setSummary(name);
  77 + }
  78 + }
  79 +
  80 + } else {
  81 + // For all other preferences, set the summary to the value's
  82 + // simple string representation.
  83 + preference.setSummary(stringValue);
  84 + }
  85 + return true;
  86 + }
  87 + };
  88 +
  89 + /**
  90 + * Helper method to determine if the device has an extra-large screen. For
  91 + * example, 10" tablets are extra-large.
  92 + */
  93 + private static boolean isXLargeTablet(Context context) {
  94 + return (context.getResources().getConfiguration().screenLayout
  95 + & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
  96 + }
  97 +
  98 + /**
  99 + * Binds a preference's summary to its value. More specifically, when the
  100 + * preference's value is changed, its summary (line of text below the
  101 + * preference title) is updated to reflect the value. The summary is also
  102 + * immediately updated upon calling this method. The exact display format is
  103 + * dependent on the type of preference.
  104 + *
  105 + * @see #sBindPreferenceSummaryToValueListener
  106 + */
  107 + private static void bindPreferenceSummaryToValue(Preference preference) {
  108 + // Set the listener to watch for value changes.
  109 + preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
  110 +
  111 + // Trigger the listener immediately with the preference's
  112 + // current value.
  113 + sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
  114 + PreferenceManager
  115 + .getDefaultSharedPreferences(preference.getContext())
  116 + .getString(preference.getKey(), ""));
  117 + }
  118 +
  119 + @Override
  120 + protected void onCreate(Bundle savedInstanceState) {
  121 + super.onCreate(savedInstanceState);
  122 + setupActionBar();
  123 + }
  124 +
  125 + /**
  126 + * Set up the {@link android.app.ActionBar}, if the API is available.
  127 + */
  128 + private void setupActionBar() {
  129 + ActionBar actionBar = getSupportActionBar();
  130 + if (actionBar != null) {
  131 + // Show the Up button in the action bar.
  132 + actionBar.setDisplayHomeAsUpEnabled(true);
  133 + }
  134 + }
  135 +
  136 + /**
  137 + * {@inheritDoc}
  138 + */
  139 + @Override
  140 + public boolean onIsMultiPane() {
  141 + return isXLargeTablet(this);
  142 + }
  143 +
  144 + /**
  145 + * {@inheritDoc}
  146 + */
  147 + @Override
  148 + @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  149 + public void onBuildHeaders(List<Header> target) {
  150 + loadHeadersFromResource(R.xml.pref_headers, target);
  151 + }
  152 +
  153 + /**
  154 + * This method stops fragment injection in malicious applications.
  155 + * Make sure to deny any unknown fragments here.
  156 + */
  157 + protected boolean isValidFragment(String fragmentName) {
  158 + return PreferenceFragment.class.getName().equals(fragmentName)
  159 + || GeneralPreferenceFragment.class.getName().equals(fragmentName)
  160 + || DataSyncPreferenceFragment.class.getName().equals(fragmentName)
  161 + || NotificationPreferenceFragment.class.getName().equals(fragmentName);
  162 + }
  163 +
  164 + /**
  165 + * This fragment shows general preferences only. It is used when the
  166 + * activity is showing a two-pane settings UI.
  167 + */
  168 + @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  169 + public static class GeneralPreferenceFragment extends PreferenceFragment {
  170 + @Override
  171 + public void onCreate(Bundle savedInstanceState) {
  172 + super.onCreate(savedInstanceState);
  173 + addPreferencesFromResource(R.xml.pref_general);
  174 + setHasOptionsMenu(true);
  175 +
  176 + // Bind the summaries of EditText/List/Dialog/Ringtone preferences
  177 + // to their values. When their values change, their summaries are
  178 + // updated to reflect the new value, per the Android Design
  179 + // guidelines.
  180 + bindPreferenceSummaryToValue(findPreference("example_text"));
  181 + bindPreferenceSummaryToValue(findPreference("example_list"));
  182 + }
  183 +
  184 + @Override
  185 + public boolean onOptionsItemSelected(MenuItem item) {
  186 + int id = item.getItemId();
  187 + if (id == android.R.id.home) {
  188 + startActivity(new Intent(getActivity(), SettingsActivity.class));
  189 + return true;
  190 + }
  191 + return super.onOptionsItemSelected(item);
  192 + }
  193 + }
  194 +
  195 + /**
  196 + * This fragment shows notification preferences only. It is used when the
  197 + * activity is showing a two-pane settings UI.
  198 + */
  199 + @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  200 + public static class NotificationPreferenceFragment extends PreferenceFragment {
  201 + @Override
  202 + public void onCreate(Bundle savedInstanceState) {
  203 + super.onCreate(savedInstanceState);
  204 + addPreferencesFromResource(R.xml.pref_notification);
  205 + setHasOptionsMenu(true);
  206 +
  207 + // Bind the summaries of EditText/List/Dialog/Ringtone preferences
  208 + // to their values. When their values change, their summaries are
  209 + // updated to reflect the new value, per the Android Design
  210 + // guidelines.
  211 + bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
  212 + }
  213 +
  214 + @Override
  215 + public boolean onOptionsItemSelected(MenuItem item) {
  216 + int id = item.getItemId();
  217 + if (id == android.R.id.home) {
  218 + startActivity(new Intent(getActivity(), SettingsActivity.class));
  219 + return true;
  220 + }
  221 + return super.onOptionsItemSelected(item);
  222 + }
  223 + }
  224 +
  225 + /**
  226 + * This fragment shows data and sync preferences only. It is used when the
  227 + * activity is showing a two-pane settings UI.
  228 + */
  229 + @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  230 + public static class DataSyncPreferenceFragment extends PreferenceFragment {
  231 + @Override
  232 + public void onCreate(Bundle savedInstanceState) {
  233 + super.onCreate(savedInstanceState);
  234 + addPreferencesFromResource(R.xml.pref_data_sync);
  235 + setHasOptionsMenu(true);
  236 +
  237 + // Bind the summaries of EditText/List/Dialog/Ringtone preferences
  238 + // to their values. When their values change, their summaries are
  239 + // updated to reflect the new value, per the Android Design
  240 + // guidelines.
  241 + bindPreferenceSummaryToValue(findPreference("sync_frequency"));
  242 + }
  243 +
  244 + @Override
  245 + public boolean onOptionsItemSelected(MenuItem item) {
  246 + int id = item.getItemId();
  247 + if (id == android.R.id.home) {
  248 + startActivity(new Intent(getActivity(), SettingsActivity.class));
  249 + return true;
  250 + }
  251 + return super.onOptionsItemSelected(item);
  252 + }
  253 + }
  254 +}
... ...
app/src/main/res/drawable/ic_info_black_24dp.xml 0 → 100644
  1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:width="24dp"
  3 + android:height="24dp"
  4 + android:viewportHeight="24.0"
  5 + android:viewportWidth="24.0">
  6 + <path
  7 + android:fillColor="#FF000000"
  8 + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,15h-2v-6h2v6zm0,-8h-2V7h2v2z" />
  9 +</vector>
... ...
app/src/main/res/drawable/ic_notifications_black_24dp.xml 0 → 100644
  1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:width="24dp"
  3 + android:height="24dp"
  4 + android:viewportHeight="24.0"
  5 + android:viewportWidth="24.0">
  6 + <path
  7 + android:fillColor="#FF000000"
  8 + android:pathData="M11.5,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zm6.5,-6v-5.5c0,-3.07 -2.13,-5.64 -5,-6.32V3.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,2.67 10,3.5v0.68c-2.87,0.68 -5,3.25 -5,6.32V16l-2,2v1h17v-1l-2,-2z" />
  9 +</vector>
... ...
app/src/main/res/drawable/ic_sync_black_24dp.xml 0 → 100644
  1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:width="24dp"
  3 + android:height="24dp"
  4 + android:viewportHeight="24.0"
  5 + android:viewportWidth="24.0">
  6 + <path
  7 + android:fillColor="#FF000000"
  8 + android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-.25 1.97,-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01.25,-1.97.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z" />
  9 +</vector>
0 10 \ No newline at end of file
... ...
app/src/main/res/layout/activity_positioning.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + xmlns:tools="http://schemas.android.com/tools"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + tools:context="fr.utbm.lo53.p2017.positionningapp.PositioningActivity">
  8 +
  9 + <android.support.design.widget.AppBarLayout
  10 + android:layout_width="match_parent"
  11 + android:layout_height="wrap_content"
  12 + android:theme="@style/AppTheme.AppBarOverlay">
  13 +
  14 + <android.support.v7.widget.Toolbar
  15 + android:id="@+id/toolbar"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="?attr/actionBarSize"
  18 + android:background="?attr/colorPrimary"
  19 + app:popupTheme="@style/AppTheme.PopupOverlay" />
  20 +
  21 + </android.support.design.widget.AppBarLayout>
  22 +
  23 + <include layout="@layout/content_positioning" />
  24 +
  25 +</android.support.design.widget.CoordinatorLayout>
... ...
app/src/main/res/layout/content_positioning.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + xmlns:tools="http://schemas.android.com/tools"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + app:layout_behavior="@string/appbar_scrolling_view_behavior"
  8 + tools:context="fr.utbm.lo53.p2017.positionningapp.PositioningActivity"
  9 + tools:showIn="@layout/activity_positioning">
  10 +
  11 + <ImageView
  12 + android:id="@+id/imageView"
  13 + android:layout_width="0dp"
  14 + android:layout_height="wrap_content"
  15 + android:layout_marginLeft="8dp"
  16 + android:layout_marginRight="8dp"
  17 + android:layout_marginTop="8dp"
  18 + android:scaleType="fitXY"
  19 + app:layout_constraintLeft_toLeftOf="parent"
  20 + app:layout_constraintRight_toRightOf="parent"
  21 + app:layout_constraintTop_toTopOf="parent"
  22 + app:srcCompat="@drawable/map"
  23 + android:layout_marginStart="8dp"
  24 + android:layout_marginEnd="8dp" />
  25 +
  26 + <ImageView
  27 + android:id="@+id/alpha_background"
  28 + android:layout_width="0dp"
  29 + android:layout_height="0dp"
  30 + android:alpha=".85"
  31 + app:layout_constraintBottom_toBottomOf="parent"
  32 + app:layout_constraintLeft_toLeftOf="parent"
  33 + app:layout_constraintRight_toRightOf="parent"
  34 + app:layout_constraintTop_toTopOf="parent"
  35 + app:srcCompat="@android:color/background_dark" />
  36 +
  37 + <Button
  38 + android:id="@+id/button_start"
  39 + style="@style/Widget.AppCompat.Button.Borderless.Colored"
  40 + android:layout_width="wrap_content"
  41 + android:layout_height="wrap_content"
  42 + android:layout_marginBottom="8dp"
  43 + android:layout_marginEnd="8dp"
  44 + android:layout_marginLeft="8dp"
  45 + android:layout_marginRight="8dp"
  46 + android:layout_marginStart="8dp"
  47 + android:layout_marginTop="8dp"
  48 + android:text="Start locating"
  49 + android:textSize="@dimen/big_text_size"
  50 + android:textStyle="bold"
  51 + app:layout_constraintBottom_toBottomOf="parent"
  52 + app:layout_constraintLeft_toLeftOf="parent"
  53 + app:layout_constraintRight_toRightOf="parent"
  54 + app:layout_constraintTop_toTopOf="parent" />
  55 +
  56 +</android.support.constraint.ConstraintLayout>
... ...
app/src/main/res/menu/menu_calibration.xml
... ... @@ -7,4 +7,9 @@
7 7 android:orderInCategory="100"
8 8 android:title="@string/action_settings"
9 9 app:showAsAction="never" />
  10 + <item
  11 + android:id="@+id/bt_open_locate_activity"
  12 + android:icon="@drawable/map_marker"
  13 + android:orderInCategory="101"
  14 + android:title="Locate !" />
10 15 </menu>
... ...
app/src/main/res/values/dimens.xml
1 1 <resources>
2 2 <dimen name="fab_margin">16dp</dimen>
  3 + <dimen name="big_text_size">30sp</dimen>
3 4 </resources>
... ...
app/src/main/res/values/strings.xml
1 1 <resources>
2 2 <string name="app_name">PositionningApp</string>
3 3 <string name="action_settings">Settings</string>
  4 + <string name="title_activity_settings">Settings</string>
  5 +
  6 + <!-- Strings related to Settings -->
  7 +
  8 + <!-- Example General settings -->
  9 + <string name="pref_header_general">General</string>
  10 +
  11 + <string name="pref_title_social_recommendations">Enable social recommendations</string>
  12 + <string name="pref_description_social_recommendations">Recommendations for people to contact
  13 + based on your message history
  14 + </string>
  15 +
  16 + <string name="pref_title_display_name">Display name</string>
  17 + <string name="pref_default_display_name">John Smith</string>
  18 +
  19 + <string name="pref_title_add_friends_to_messages">Add friends to messages</string>
  20 + <string-array name="pref_example_list_titles">
  21 + <item>Always</item>
  22 + <item>When possible</item>
  23 + <item>Never</item>
  24 + </string-array>
  25 + <string-array name="pref_example_list_values">
  26 + <item>1</item>
  27 + <item>0</item>
  28 + <item>-1</item>
  29 + </string-array>
  30 +
  31 + <!-- Example settings for Data & Sync -->
  32 + <string name="pref_header_data_sync">Data &amp; sync</string>
  33 +
  34 + <string name="pref_title_sync_frequency">Sync frequency</string>
  35 + <string-array name="pref_sync_frequency_titles">
  36 + <item>15 minutes</item>
  37 + <item>30 minutes</item>
  38 + <item>1 hour</item>
  39 + <item>3 hours</item>
  40 + <item>6 hours</item>
  41 + <item>Never</item>
  42 + </string-array>
  43 + <string-array name="pref_sync_frequency_values">
  44 + <item>15</item>
  45 + <item>30</item>
  46 + <item>60</item>
  47 + <item>180</item>
  48 + <item>360</item>
  49 + <item>-1</item>
  50 + </string-array>
  51 +
  52 + <string-array name="list_preference_entries">
  53 + <item>Entry 1</item>
  54 + <item>Entry 2</item>
  55 + <item>Entry 3</item>
  56 + </string-array>
  57 +
  58 + <string-array name="list_preference_entry_values">
  59 + <item>1</item>
  60 + <item>2</item>
  61 + <item>3</item>
  62 + </string-array>
  63 +
  64 + <string-array name="multi_select_list_preference_default_value" />
  65 +
  66 + <string name="pref_title_system_sync_settings">System sync settings</string>
  67 +
  68 + <!-- Example settings for Notifications -->
  69 + <string name="pref_header_notifications">Notifications</string>
  70 +
  71 + <string name="pref_title_new_message_notifications">New message notifications</string>
  72 +
  73 + <string name="pref_title_ringtone">Ringtone</string>
  74 + <string name="pref_ringtone_silent">Silent</string>
  75 +
  76 + <string name="pref_title_vibrate">Vibrate</string>
  77 + <string name="title_activity_positioning">Positioning</string>
4 78 </resources>
... ...
app/src/main/res/xml/pref_data_sync.xml 0 → 100644
  1 +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
  2 +
  3 + <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
  4 + dismiss it. -->
  5 + <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
  6 + <ListPreference
  7 + android:defaultValue="180"
  8 + android:entries="@array/pref_sync_frequency_titles"
  9 + android:entryValues="@array/pref_sync_frequency_values"
  10 + android:key="sync_frequency"
  11 + android:negativeButtonText="@null"
  12 + android:positiveButtonText="@null"
  13 + android:title="@string/pref_title_sync_frequency" />
  14 +
  15 + <!-- This preference simply launches an intent when selected. Use this UI sparingly, per
  16 + design guidelines. -->
  17 + <Preference android:title="@string/pref_title_system_sync_settings">
  18 + <intent android:action="android.settings.SYNC_SETTINGS" />
  19 + </Preference>
  20 +
  21 +</PreferenceScreen>
... ...
app/src/main/res/xml/pref_general.xml 0 → 100644
  1 +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
  2 +
  3 + <SwitchPreference
  4 + android:defaultValue="true"
  5 + android:key="example_switch"
  6 + android:summary="@string/pref_description_social_recommendations"
  7 + android:title="@string/pref_title_social_recommendations" />
  8 +
  9 + <!-- NOTE: EditTextPreference accepts EditText attributes. -->
  10 + <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
  11 + <EditTextPreference
  12 + android:capitalize="words"
  13 + android:defaultValue="@string/pref_default_display_name"
  14 + android:inputType="textCapWords"
  15 + android:key="example_text"
  16 + android:maxLines="1"
  17 + android:selectAllOnFocus="true"
  18 + android:singleLine="true"
  19 + android:title="@string/pref_title_display_name" />
  20 +
  21 + <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
  22 + dismiss it. -->
  23 + <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
  24 + <ListPreference
  25 + android:defaultValue="-1"
  26 + android:entries="@array/pref_example_list_titles"
  27 + android:entryValues="@array/pref_example_list_values"
  28 + android:key="example_list"
  29 + android:negativeButtonText="@null"
  30 + android:positiveButtonText="@null"
  31 + android:title="@string/pref_title_add_friends_to_messages" />
  32 + <EditTextPreference
  33 + android:defaultValue="127.0.0.1"
  34 + android:key="edit_text_hostname"
  35 + android:selectAllOnFocus="true"
  36 + android:singleLine="true"
  37 + android:title="Hostname" />
  38 + <EditTextPreference
  39 + android:layout_width="wrap_content"
  40 + android:layout_height="wrap_content"
  41 + android:defaultValue="8080"
  42 + android:key="edit_text_port"
  43 + android:selectAllOnFocus="true"
  44 + android:singleLine="true"
  45 + android:title="Port" />
  46 +
  47 +
  48 +</PreferenceScreen>
... ...
app/src/main/res/xml/pref_headers.xml 0 → 100644
  1 +<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
  2 +
  3 + <!-- These settings headers are only used on tablets. -->
  4 +
  5 + <header
  6 + android:fragment="fr.utbm.lo53.p2017.positionningapp.SettingsActivity$GeneralPreferenceFragment"
  7 + android:icon="@drawable/ic_info_black_24dp"
  8 + android:title="@string/pref_header_general" />
  9 +
  10 + <header
  11 + android:fragment="fr.utbm.lo53.p2017.positionningapp.SettingsActivity$NotificationPreferenceFragment"
  12 + android:icon="@drawable/ic_notifications_black_24dp"
  13 + android:title="@string/pref_header_notifications" />
  14 +
  15 + <header
  16 + android:fragment="fr.utbm.lo53.p2017.positionningapp.SettingsActivity$DataSyncPreferenceFragment"
  17 + android:icon="@drawable/ic_sync_black_24dp"
  18 + android:title="@string/pref_header_data_sync" />
  19 +
  20 +</preference-headers>
  21 +
... ...
app/src/main/res/xml/pref_notification.xml 0 → 100644
  1 +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
  2 +
  3 + <!-- A 'parent' preference, which enables/disables child preferences (below)
  4 + when checked/unchecked. -->
  5 + <SwitchPreference
  6 + android:defaultValue="true"
  7 + android:key="notifications_new_message"
  8 + android:title="@string/pref_title_new_message_notifications" />
  9 +
  10 + <!-- Allows the user to choose a ringtone in the 'notification' category. -->
  11 + <!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
  12 + <!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
  13 + <RingtonePreference
  14 + android:defaultValue="content://settings/system/notification_sound"
  15 + android:dependency="notifications_new_message"
  16 + android:key="notifications_new_message_ringtone"
  17 + android:ringtoneType="notification"
  18 + android:title="@string/pref_title_ringtone" />
  19 +
  20 + <!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
  21 + <SwitchPreference
  22 + android:defaultValue="true"
  23 + android:dependency="notifications_new_message"
  24 + android:key="notifications_new_message_vibrate"
  25 + android:title="@string/pref_title_vibrate" />
  26 +
  27 +</PreferenceScreen>
... ...