diff --git a/app/build.gradle b/app/build.gradle index eacb4c6..8169dc0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,6 +13,7 @@ android { versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true } buildTypes { release { @@ -22,7 +23,7 @@ android { } } -repositories{ +repositories { maven { url 'http://dl.bintray.com/amulyakhare/maven' } @@ -32,6 +33,9 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' + + implementation 'com.android.support:support-v4:27.1.1' + implementation 'com.android.support:support-vector-drawable:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0732372..304f508 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,39 +16,45 @@ android:name="android.hardware.location.gps" android:required="true" /> - + - - - + android:launchMode="singleTop" /> - + android:launchMode="singleTask" + android:noHistory="true" /> + + + + = 0 + ? listPreference.getEntries()[index] + : null); + + } else if (preference instanceof EditTextPreference) { + if (preference.getKey().equals("key_gallery_name")) { + // update the changed gallery name to summary filed + preference.setSummary(stringValue); + } + } else { + preference.setSummary(stringValue); + } + return true; + } + }; + + /** + * Email client intent to send support mail + * Appends the necessary device information to email body + * useful when providing support + */ + public static void sendFeedback(Context context) { + String body = null; + try { + body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " + + Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND + + "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER; + } catch (PackageManager.NameNotFoundException e) { + } + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("message/rfc822"); + intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"team@findmytutor.com"}); + intent.putExtra(Intent.EXTRA_SUBJECT, "Query from android app"); + intent.putExtra(Intent.EXTRA_TEXT, body); + context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client))); + } +} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingActivity.java new file mode 100644 index 0000000..1c0743d --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingActivity.java @@ -0,0 +1,112 @@ +package com.uam.wmi.findmytutor.activity; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.os.Build; +import android.os.Bundle; +import android.preference.EditTextPreference; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.view.MenuItem; +import com.uam.wmi.findmytutor.R; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + + +public class SharingActivity extends AppCompatPreferenceActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit(); + } + + public static class MainPreferenceFragment extends PreferenceFragment { + @Override + public void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.pref_sharing); + Preference manualStatus = findPreference("key_manual_status"); + manualStatus.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + ListPreference lp = (ListPreference) findPreference("key_status_value"); + updateListPreference(lp ,newValue,"manual_statuses"); + return true; + } + }); + Preference manualLoction = findPreference("key_manual_location_custom"); + manualLoction.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + ListPreference lp = (ListPreference) findPreference("manual_location_list_title"); + updateListPreference(lp ,newValue,"manual_locations"); + return true; + } + }); + + } + protected void updateListPreference(ListPreference lp,Object newValue,String storageKey){ + CharSequence [] entries = lp.getEntries(); + Set defaultEntries = new HashSet(Arrays.asList(entries)); + SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); + Set manualStatusSet = sharedPref.getStringSet(storageKey,defaultEntries); + manualStatusSet.add((String) newValue); + String [] manualStatusArr = manualStatusSet.toArray(new String[0]); + Arrays.sort(manualStatusArr); + setListPreferenceData(lp.getKey(),manualStatusArr); + SharedPreferences.Editor editor = sharedPref.edit(); + editor.putStringSet(storageKey,manualStatusSet); + editor.commit(); + } + protected ListPreference setListPreferenceData(String lp_name, String [] entries) { + ListPreference lp = (ListPreference) findPreference(lp_name); + lp.setEntries(entries); + CharSequence[] entryValues = new CharSequence [entries.length]; + for (int i = 0; i < entries.length; i++){ + entryValues[i] = Integer.toString(i+1); + } + lp.setDefaultValue("1"); + lp.setEntryValues(entryValues); + return lp; + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + onBackPressed(); + } + return super.onOptionsItemSelected(item); + } + + /** + * Email client intent to send support mail + * Appends the necessary device information to email body + * useful when providing support + */ +/* public static void sendFeedback(Context context) { + String body = null; + try { + body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " + + Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND + + "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER; + } catch (PackageManager.NameNotFoundException e) { + } + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("message/rfc822"); + intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"team@findmytutor.com"}); + intent.putExtra(Intent.EXTRA_SUBJECT, "Query from android app"); + intent.putExtra(Intent.EXTRA_TEXT, body); + context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client))); + }*/ +} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java index 04bda3d..2297c0e 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java @@ -14,7 +14,9 @@ public class StartupActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - if (isLoggedIn()) { + + if (isLoggedIn()){ + Intent startupIntent = new Intent(this, MainActivity.class); startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(startupIntent); @@ -23,7 +25,6 @@ public class StartupActivity extends AppCompatActivity { Intent loginIntent = new Intent(this, LoginActivity.class); startActivityForResult(loginIntent, AUTHENTICATION_REQUEST_CODE); } - super.onCreate(savedInstanceState); } diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 3296409..f4cbc1b 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -67,7 +67,7 @@ diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 6a4f18b..5a62888 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -7,4 +7,43 @@ Hasło jest zbyt krótkie Nieprawidłowy mail To pole jest wymagane + + + + + Udostępnianie + Udostępnianie lokalizacji + Poziom udostępniania + Obecność + Przybliżona + Dokładna + Sczegółowość udostępniania + key_location_level + + Status + Nie przeszkadzać + Czekam na studentów + Na wakacjach + Opis + key_description + + Ogólne + key_notifications_enabled + Włącz powiadomienia + Język + Angielski + Polski + Wybierz język + + O aplikacji + We are just like you :)\nA group of people trying to shape our everyday life into something useful. We hope to bring you the best product and quality of service.\nThank you for using our app ! + 0.1.0 + Masz jakieś pytania? Uwagi? Chętnie odpiszemy! + Skontaktuj się z nami + Polityka Prywatności + http://findmytutor.projektstudencki.pl/privacy-policy/ + Warunki korzystania + http://findmytutor.projektstudencki.pl/terms-of-service/ + Wersja + Wybierz klienta poczty \ No newline at end of file diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index aadfc8e..815402b 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -40,4 +40,42 @@ #9e9e9e #607d8b + + @string/location_level_presence + @string/location_level_approximated + @string/location_level_precise + + + 0 + 1 + 2 + + + @string/description_available + @string/description_busy + @string/description_consultation + + + 0 + 1 + 2 + + + @string/assembly_c + @string/assembly_a + @string/passage_d + + + 0 + 1 + 2 + + + @string/lang_eng + @string/lang_pol + + + 0 + 1 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5f7c1c4..aac502f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -41,6 +41,146 @@ functionality. Black List White List + Settings + + + + + + Sharing + + + + + Sharing + + Location sharing + Sharing level + Only presence + Approximated + Exact + Location level + key_location_level + + Choose status + Status + Busy + Available + Consultation + Add custom status + + + + Descrition + key_description + + + Manual location + Choose manual location + Add custom location + Assembly Hall A + Assembly Hall C + Passage D + + + General + key_notifications_enabled + Enable notifications + + Language + English + Polish + Choose language + key_language + + + About + We are just like you :)\nA group of people trying to shape our everyday life into something useful. We hope to bring you the best product and quality of service.\nThank you for using our app ! + 0.1.0 + Got any queries? We are happy to help! + Send Feedback + key_send_feedback + Privacy Policy + http://findmytutor.projektstudencki.pl/privacy-policy/ + Terms & Conditions + http://findmytutor.projektstudencki.pl/terms-of-service/ + Version + Choose email client + Settings + + + + + General + + Enable social recommendations + Recommendations for people to contact + based on your message history + + + Display name + John Smith + + Add friends to messages + + Always + When possible + Never + + + 1 + 0 + -1 + + + + Data & sync + + Sync frequency + + 15 minutes + 30 minutes + 1 hour + 3 hours + 6 hours + Never + + + 15 + 30 + 60 + 180 + 360 + -1 + + + + Entry 1 + Entry 2 + Entry 3 + + + + 1 + 2 + 3 + + + + + System sync settings + + + Notifications + + New message notifications + + Ringtone + Silent + + Vibrate + + Settings OK @@ -55,5 +195,5 @@ functionality. One location reported %d locations reported - Default channel + diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml new file mode 100644 index 0000000..0c13e23 --- /dev/null +++ b/app/src/main/res/xml/pref_main.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_sharing.xml b/app/src/main/res/xml/pref_sharing.xml new file mode 100644 index 0000000..3e056d1 --- /dev/null +++ b/app/src/main/res/xml/pref_sharing.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + \ No newline at end of file