diff --git a/app/build.gradle b/app/build.gradle
index 6f6f95d..1403eca 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'
}
@@ -33,6 +34,8 @@ dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
+ implementation 'com.android.support:support-v4:27.1.1'
+ implementation 'com.android.support:support-vector-drawable:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5f227e5..6ec636c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,7 +11,6 @@
-
-
-
+
-
-
-
+ android:launchMode="singleTop">
-
+ android:launchMode="singleTask"
+ android:noHistory="true">
+
\ No newline at end of file
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/AppCompatPreferenceActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/AppCompatPreferenceActivity.java
new file mode 100644
index 0000000..789cc5e
--- /dev/null
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/AppCompatPreferenceActivity.java
@@ -0,0 +1,109 @@
+package com.uam.wmi.findmytutor.activity;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.support.annotation.LayoutRes;
+import android.support.annotation.Nullable;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatDelegate;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
+ * to be used with AppCompat.
+ */
+public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
+
+ private AppCompatDelegate mDelegate;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ getDelegate().installViewFactory();
+ getDelegate().onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ getDelegate().onPostCreate(savedInstanceState);
+ }
+
+ public ActionBar getSupportActionBar() {
+ return getDelegate().getSupportActionBar();
+ }
+
+ public void setSupportActionBar(@Nullable Toolbar toolbar) {
+ getDelegate().setSupportActionBar(toolbar);
+ }
+
+ @Override
+ public MenuInflater getMenuInflater() {
+ return getDelegate().getMenuInflater();
+ }
+
+ @Override
+ public void setContentView(@LayoutRes int layoutResID) {
+ getDelegate().setContentView(layoutResID);
+ }
+
+ @Override
+ public void setContentView(View view) {
+ getDelegate().setContentView(view);
+ }
+
+ @Override
+ public void setContentView(View view, ViewGroup.LayoutParams params) {
+ getDelegate().setContentView(view, params);
+ }
+
+ @Override
+ public void addContentView(View view, ViewGroup.LayoutParams params) {
+ getDelegate().addContentView(view, params);
+ }
+
+ @Override
+ protected void onPostResume() {
+ super.onPostResume();
+ getDelegate().onPostResume();
+ }
+
+ @Override
+ protected void onTitleChanged(CharSequence title, int color) {
+ super.onTitleChanged(title, color);
+ getDelegate().setTitle(title);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ getDelegate().onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ getDelegate().onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ getDelegate().onDestroy();
+ }
+
+ public void invalidateOptionsMenu() {
+ getDelegate().invalidateOptionsMenu();
+ }
+
+ private AppCompatDelegate getDelegate() {
+ if (mDelegate == null) {
+ mDelegate = AppCompatDelegate.create(this, null);
+ }
+ return mDelegate;
+ }
+}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/SettingsActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/SettingsActivity.java
new file mode 100644
index 0000000..c96bd42
--- /dev/null
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/SettingsActivity.java
@@ -0,0 +1,119 @@
+package com.uam.wmi.findmytutor.activity;
+
+import android.content.Context;
+import android.content.Intent;
+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;
+
+
+public class SettingsActivity extends AppCompatPreferenceActivity {
+ private static final String TAG = SettingsActivity.class.getSimpleName();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ // load settings fragment
+ 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_main);
+
+ //TODO add on change listeners for preferences
+
+ // feedback preference click listener
+ Preference myPref = findPreference(getString(R.string.key_send_feedback));
+ myPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ public boolean onPreferenceClick(Preference preference) {
+ sendFeedback(getActivity());
+ return true;
+ }
+ });
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ onBackPressed();
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private static void bindPreferenceSummaryToValue(Preference preference) {
+ preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
+
+ sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
+ PreferenceManager
+ .getDefaultSharedPreferences(preference.getContext())
+ .getString(preference.getKey(), ""));
+ }
+
+ /**
+ * A preference value change listener that updates the preference's summary
+ * to reflect its new value.
+ */
+ private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ String stringValue = newValue.toString();
+
+ if (preference instanceof ListPreference) {
+ // For list preferences, look up the correct display value in
+ // the preference's 'entries' list.
+ ListPreference listPreference = (ListPreference) preference;
+ int index = listPreference.findIndexOfValue(stringValue);
+
+ // Set the summary to reflect the new value.
+ preference.setSummary(
+ index >= 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/StartupActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java
index 257b01f..a1214b3 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
@@ -12,17 +12,18 @@ public class StartupActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
+ //uncomment for testin settings activity and comment the rest of onCreate body
+ // startActivity(new Intent(this, SettingsActivity.class));
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);
+ startActivity(startupIntent);gi
finish();
} else {
Intent loginIntent = new Intent(this, LoginActivity.class);
startActivityForResult(loginIntent, AUTHENTICATION_REQUEST_CODE);
}
-
super.onCreate(savedInstanceState);
//to nie ma miec layoutu wiec elo
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 6a4f18b..392f881 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -7,4 +7,39 @@
Hasło jest zbyt krótkie
Nieprawidłowy mail
To pole jest wymagane
+
+ 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..5d3ce73 100644
--- a/app/src/main/res/values/array.xml
+++ b/app/src/main/res/values/array.xml
@@ -40,4 +40,32 @@
- #9e9e9e
- #607d8b
+
+ - @string/location_level_presence
+ - @string/location_level_approximated
+ - @string/location_level_precise
+
+
+ - 0
+ - 1
+ - 2
+
+
+ - @string/description_awaiting
+ - @string/description_notdisturb
+ - @string/description_onholidays
+
+
+ - 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 bc72b2f..c000d31 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -37,4 +37,45 @@
pk.eyJ1IjoiZG9tYWdhbHNreSIsImEiOiJjamd4am4zazYwNXo1MzBxeDZtYjA4d2s4In0.KzNdhc9V_-SYe14AZ-q3Ew
Black List
White List
+ Settings
+
+
+ Location sharing
+ Sharing level
+ Only presence
+ Approximated
+ Precise
+ Location level
+ key_location_level
+
+ Status
+ Do not disturb
+ Awaiting for students
+ On Holidays
+ Descrition
+ key_description
+
+ 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
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..e73fc95
--- /dev/null
+++ b/app/src/main/res/xml/pref_main.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file