diff --git a/.gradle/5.1.1/executionHistory/executionHistory.bin b/.gradle/5.1.1/executionHistory/executionHistory.bin index f1d44717885c3671ad510338ff12472e8baee8a3..716216759bc19b631bb718026f846051a5c0d5ee 100644 Binary files a/.gradle/5.1.1/executionHistory/executionHistory.bin and b/.gradle/5.1.1/executionHistory/executionHistory.bin differ diff --git a/.gradle/5.1.1/executionHistory/executionHistory.lock b/.gradle/5.1.1/executionHistory/executionHistory.lock index 43e18723f59e15a831680b710b10218253d52ec4..b7df5673b5e9991869a066e0b302c56e2895491e 100644 Binary files a/.gradle/5.1.1/executionHistory/executionHistory.lock and b/.gradle/5.1.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/5.1.1/fileHashes/fileHashes.bin b/.gradle/5.1.1/fileHashes/fileHashes.bin index 1a5c1b5fd29dd7c45b55ce8d2fabab22da42a4aa..bceba7b86fe88165c2df6ea4056e34db1b7611b5 100644 Binary files a/.gradle/5.1.1/fileHashes/fileHashes.bin and b/.gradle/5.1.1/fileHashes/fileHashes.bin differ diff --git a/.gradle/5.1.1/fileHashes/fileHashes.lock b/.gradle/5.1.1/fileHashes/fileHashes.lock index f657af5742588222b91d689da41138fecf81aee1..44bfb734a5ab068a68bf58ac72244d37a27625ab 100644 Binary files a/.gradle/5.1.1/fileHashes/fileHashes.lock and b/.gradle/5.1.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/5.1.1/javaCompile/classAnalysis.bin b/.gradle/5.1.1/javaCompile/classAnalysis.bin index c82cd864244e459676393e23ac2b5093badfdc91..f06c12a24291556ac766cda831497ed754502812 100644 Binary files a/.gradle/5.1.1/javaCompile/classAnalysis.bin and b/.gradle/5.1.1/javaCompile/classAnalysis.bin differ diff --git a/.gradle/5.1.1/javaCompile/javaCompile.lock b/.gradle/5.1.1/javaCompile/javaCompile.lock index c495c7f1aa18296682359742b32c71aa7d4cad0c..2bb9c682d806159e7dc274388a691f26dce3c4fb 100644 Binary files a/.gradle/5.1.1/javaCompile/javaCompile.lock and b/.gradle/5.1.1/javaCompile/javaCompile.lock differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index ba40e7b3471be826260aa25d51f56f1e559fe6b4..6d84db3dc654193e723da2107a19219bc2a5201f 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/src/main/java/com/example/liliyayankova/unirides/Driver_Register.java b/src/main/java/com/example/liliyayankova/unirides/Driver_Register.java index 5b9625d084a68aac4738001bbdaeaec1ceb33662..7d3204e77db7272722942daf158c8dcb8fce2dd3 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Driver_Register.java +++ b/src/main/java/com/example/liliyayankova/unirides/Driver_Register.java @@ -4,9 +4,14 @@ import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; +import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; @@ -43,6 +48,18 @@ public class Driver_Register extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_driver_register); + + //setting the user_toolbar layout as the action bar + Toolbar toolbar = findViewById(R.id.toolbar); + try { + setSupportActionBar(toolbar); + } catch (Exception e) { + Log.e("TOOLBAR", e.toString()); + } + + //makes it so the keyboard doesn't automatically popup! + this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); + this.forename = findViewById(R.id.forename); this.surname = findViewById(R.id.surname); this.email = findViewById(R.id.email); @@ -124,4 +141,30 @@ public class Driver_Register extends AppCompatActivity { } + //Override for the user_toolbar menu items + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch(item.getItemId()){ + + case(R.id.item_settings): + + Intent settings_i = new Intent(Driver_Register.this, Settings.class); + settings_i.putExtra("userType", Login.userType.NONE); + startActivity(settings_i); + return true; + + } + + return super.onOptionsItemSelected(item); + } + } diff --git a/src/main/java/com/example/liliyayankova/unirides/Homepage.java b/src/main/java/com/example/liliyayankova/unirides/Homepage.java index 548f1619d51eaef8dfaeb1ed005355d69ef5efb8..6f36676c9ef9dc03c85262b65c4220da6a58cac4 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Homepage.java +++ b/src/main/java/com/example/liliyayankova/unirides/Homepage.java @@ -3,10 +3,16 @@ package com.example.liliyayankova.unirides; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; +import android.widget.Toast; public class Homepage extends AppCompatActivity { private TextView welcome; @@ -26,6 +32,14 @@ public class Homepage extends AppCompatActivity { this.register = (Button) findViewById(R.id.registerB); this.offline_map = findViewById(R.id.offline_map); + //setting the user_toolbar layout as the action bar + Toolbar toolbar = findViewById(R.id.toolbar); + try { + setSupportActionBar(toolbar); + } catch (Exception e) { + Log.e("TOOLBAR", e.toString()); + } + this.offline_map.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -52,4 +66,30 @@ public class Homepage extends AppCompatActivity { } }); } + + //Override for the user_toolbar menu items + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch(item.getItemId()){ + + case(R.id.item_settings): + + Intent settings_i = new Intent(Homepage.this, Settings.class); + settings_i.putExtra("userType", Login.userType.NONE); + startActivity(settings_i); + return true; + + } + + return super.onOptionsItemSelected(item); + } } diff --git a/src/main/java/com/example/liliyayankova/unirides/Login.java b/src/main/java/com/example/liliyayankova/unirides/Login.java index 98c2f2da15c22b5a211aaa175a06da528211a43a..84d9df878adfb24f032d9c3d6b4742914936909a 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Login.java +++ b/src/main/java/com/example/liliyayankova/unirides/Login.java @@ -19,10 +19,16 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; +import android.support.v7.widget.Toolbar; import android.text.TextUtils; +import android.util.Log; import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; +import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; @@ -89,7 +95,7 @@ public class Login extends AppCompatActivity implements LoaderCallbacks<Cursor> private FirebaseAuth.AuthStateListener authListener; /* Enum for user type - used in bundles when going back and forth between activities */ - public enum userType {DRIVER, PASSENGER}; + public enum userType {DRIVER, PASSENGER, NONE}; /* TODO: Look at this message from Ronan in Login.java @@ -117,6 +123,17 @@ public class Login extends AppCompatActivity implements LoaderCallbacks<Cursor> } }; + //setting the user_toolbar layout as the action bar + Toolbar toolbar = findViewById(R.id.toolbar); + try { + setSupportActionBar(toolbar); + } catch (Exception e) { + Log.e("TOOLBAR", e.toString()); + } + + //makes it so the keyboard doesn't automatically popup! + this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); + // Set up the login form. mEmailView = (AutoCompleteTextView) findViewById(R.id.email); populateAutoComplete(); @@ -489,5 +506,31 @@ public class Login extends AppCompatActivity implements LoaderCallbacks<Cursor> showProgress(false); } } + + //Override for the user_toolbar menu items + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch(item.getItemId()){ + + case(R.id.item_settings): + + Intent settings_i = new Intent(Login.this, Settings.class); + settings_i.putExtra("userType", Login.userType.NONE); + startActivity(settings_i); + return true; + + } + + return super.onOptionsItemSelected(item); + } } diff --git a/src/main/java/com/example/liliyayankova/unirides/Offline_Map.java b/src/main/java/com/example/liliyayankova/unirides/Offline_Map.java index 5a080f6bb06e6876ddd547fdaab48bd384b4e95c..d494355737851e2e8f5913dade589e54ce16f234 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Offline_Map.java +++ b/src/main/java/com/example/liliyayankova/unirides/Offline_Map.java @@ -59,6 +59,15 @@ public class Offline_Map extends AppCompatActivity implements if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ checkUserLocationPermission(); } + + //setting the user_toolbar layout as the action bar + Toolbar toolbar = findViewById(R.id.toolbar); + try { + setSupportActionBar(toolbar); + } catch (Exception e) { + Log.e("TOOLBAR", e.toString()); + } + // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); @@ -192,5 +201,31 @@ public class Offline_Map extends AppCompatActivity implements } + //Override for the user_toolbar menu items + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch(item.getItemId()){ + + case(R.id.item_settings): + + Intent settings_i = new Intent(Offline_Map.this, Settings.class); + settings_i.putExtra("userType", Login.userType.NONE); + startActivity(settings_i); + return true; + + } + + return super.onOptionsItemSelected(item); + } + } diff --git a/src/main/java/com/example/liliyayankova/unirides/Profile.java b/src/main/java/com/example/liliyayankova/unirides/Profile.java index cb3c80b38319da3d732d86dd5b94a636349b11ad..95b4ff885e79ec15afae5af1b3a29c298bc4905e 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Profile.java +++ b/src/main/java/com/example/liliyayankova/unirides/Profile.java @@ -8,6 +8,8 @@ import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.View; +import android.widget.Button; import android.widget.Toast; public class Profile extends AppCompatActivity { @@ -39,6 +41,14 @@ public class Profile extends AppCompatActivity { } catch (Exception e) { Log.e("TOOLBAR", e.toString()); } + + Button camera_button = findViewById(R.id.profile_pic); + camera_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //open camera? + } + }); } //Override for the user_toolbar menu items diff --git a/src/main/java/com/example/liliyayankova/unirides/Register.java b/src/main/java/com/example/liliyayankova/unirides/Register.java index 04c90200c37a13a52046b4d53fd5b9de3e6e986d..394b2f71e38d842950afef572dd9776c02d1f4f4 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Register.java +++ b/src/main/java/com/example/liliyayankova/unirides/Register.java @@ -3,6 +3,11 @@ package com.example.liliyayankova.unirides; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.Button; @@ -13,6 +18,14 @@ public class Register extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); + //setting the user_toolbar layout as the action bar + Toolbar toolbar = findViewById(R.id.toolbar); + try { + setSupportActionBar(toolbar); + } catch (Exception e) { + Log.e("TOOLBAR", e.toString()); + } + Button user_register = findViewById(R.id.user_signup); Button driver_register = findViewById(R.id.driver_signup); @@ -34,4 +47,30 @@ public class Register extends AppCompatActivity { } }); } + + //Override for the user_toolbar menu items + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch(item.getItemId()){ + + case(R.id.item_settings): + + Intent settings_i = new Intent(Register.this, Settings.class); + settings_i.putExtra("userType", Login.userType.NONE); + startActivity(settings_i); + return true; + + } + + return super.onOptionsItemSelected(item); + } } diff --git a/src/main/java/com/example/liliyayankova/unirides/Settings.java b/src/main/java/com/example/liliyayankova/unirides/Settings.java index fd107c50802332865e7be0bac3a356f74ba3c967..ff743fb627967900cb1cd33537e8c174fc0c1ed7 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Settings.java +++ b/src/main/java/com/example/liliyayankova/unirides/Settings.java @@ -8,21 +8,38 @@ import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CompoundButton; +import android.widget.Spinner; import android.widget.Toast; +import android.widget.ToggleButton; public class Settings extends AppCompatActivity { - //TODO: layout and functionality of settings activity need to be done! - private boolean isDriver; + private boolean isLoggedIn; + private boolean isSoundOn; + + private ToggleButton sound; + private Spinner language; + private Spinner save_location; + private Button save_button; + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); - //assume the user is a passenger (isDriver = false) unless bundle extra userType value is DRIVER + /* + * assume the user is a passenger (isDriver = false) unless bundle extra userType value is DRIVER + * also assume that the user is logged in until proven wrong + */ isDriver = false; + isLoggedIn = true; /* checking if there are any bundle extras (should be the userType) */ if(getIntent().getExtras() != null) { @@ -30,6 +47,10 @@ public class Settings extends AppCompatActivity { if(getIntent().getExtras().get("userType") == Login.userType.DRIVER){ isDriver = true; } + //if coming from the homepage (not signed in) set logged in to false + if(getIntent().getExtras().get("userType") == Login.userType.NONE){ + isLoggedIn = false; + } } //setting the user_toolbar layout as the action bar @@ -39,35 +60,118 @@ public class Settings extends AppCompatActivity { } catch (Exception e) { Log.e("TOOLBAR", e.toString()); } + + this.language = findViewById(R.id.language_spinner); + ArrayAdapter<CharSequence> l_adapter = ArrayAdapter.createFromResource(this, + R.array.languages, android.R.layout.simple_spinner_item); + l_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + language.setAdapter(l_adapter); + + this.save_location = findViewById(R.id.save_location_spinner); + ArrayAdapter<CharSequence> s_adapter = ArrayAdapter.createFromResource(this, + R.array.save_locations, android.R.layout.simple_spinner_item); + s_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + save_location.setAdapter(s_adapter); + + this.sound = findViewById(R.id.sound_toggle); + this.sound.setChecked(isSoundOn); // set the current state of a toggle button + this.sound.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + //set isSoundOn to checked value (on or off) + isSoundOn = isChecked; + } + }); + + //if no settings file found, set to default values + if(!loadSettings()){ + sound.setChecked(true); + save_location.setSelection(0); + language.setSelection(0); + } + + + this.save_button = findViewById(R.id.save_button); + this.save_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //call method saveSettings + if(saveSettings() == true) { + + if (isLoggedIn) { + if (isDriver) { + Intent D_home_i = new Intent(Settings.this, Driver_Main.class); + startActivity(D_home_i); + } else { + Intent U_home_i = new Intent(Settings.this, User_Main.class); + startActivity(U_home_i); + } + } else { + Intent home_i = new Intent(Settings.this, Homepage.class); + startActivity(home_i); + } + }else{ + Toast.makeText(Settings.this, "Failed to save settings", Toast.LENGTH_SHORT).show(); + } + } + }); + } + + //TODO: save settings to device or database + public boolean saveSettings(){ + + //if save is successful -> return true + return true; + + //if not successful -> return false + } + + //TODO: load settings from device or database + public boolean loadSettings(){ + + //if file found -> extract values -> return true + + //if no file found -> return false + return false; } //Override for the user_toolbar menu items @Override public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater menuInflater = getMenuInflater(); - menuInflater.inflate(R.menu.toolbar_menu, menu); - return true; + + //setting toolbar options depending on user logged in (offline or online) + if(isLoggedIn){ + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.toolbar_menu, menu); + return true; + }else { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } } @Override public boolean onOptionsItemSelected(MenuItem item) { - //checks the id of the item, if the item id matches a case id then the code in that case block will execute - switch(item.getItemId()){ + /* checks if user is logged in, if not it shows a different toolbar */ + if(isLoggedIn) { + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch (item.getItemId()) { - case(R.id.item_home): + case (R.id.item_home): - if (isDriver) { - Intent home_i = new Intent(Settings.this, Driver_Main.class); - startActivity(home_i); - return true; - }else{ - Intent home_i = new Intent(Settings.this, User_Main.class); - startActivity(home_i); - return true; - } + if (isDriver) { + Intent home_i = new Intent(Settings.this, Driver_Main.class); + startActivity(home_i); + return true; + } else { + Intent home_i = new Intent(Settings.this, User_Main.class); + startActivity(home_i); + return true; + } - case(R.id.item_logout): + case (R.id.item_logout): /* TODO: @@ -78,31 +182,42 @@ public class Settings extends AppCompatActivity { for now i have just set it so it goes back to the homepage (where you can register or login). */ - Toast.makeText(Settings.this, "successfully logged out", Toast.LENGTH_SHORT).show(); - Intent logout_i = new Intent(Settings.this, Homepage.class); - startActivity(logout_i); + Toast.makeText(Settings.this, "successfully logged out", Toast.LENGTH_SHORT).show(); + Intent logout_i = new Intent(Settings.this, Homepage.class); + startActivity(logout_i); - return true; + return true; - case(R.id.item_profile): + case (R.id.item_profile): - Intent profile_i = new Intent(Settings.this, Profile.class); + Intent profile_i = new Intent(Settings.this, Profile.class); - if(isDriver){ - profile_i.putExtra("userType", Login.userType.DRIVER); - }else{ - profile_i.putExtra("userType", Login.userType.PASSENGER); - } + if (isDriver) { + profile_i.putExtra("userType", Login.userType.DRIVER); + } else { + profile_i.putExtra("userType", Login.userType.PASSENGER); + } + + startActivity(profile_i); + + return true; + + case (R.id.item_settings): - startActivity(profile_i); + //do nothing (already on the settings page) + return true; + + } - return true; + }else{ - case(R.id.item_settings): + switch (item.getItemId()){ - //do nothing (already on the settings page) - return true; + case(R.id.item_settings): + //do nothing (already on the settings page) + return true; + } } return super.onOptionsItemSelected(item); diff --git a/src/main/java/com/example/liliyayankova/unirides/User_Register.java b/src/main/java/com/example/liliyayankova/unirides/User_Register.java index 55fcee015b97f21a70c2b060b4938785638c4868..a9b6a311a7ac35a4eb2cb9637561ad65f7c2e500 100644 --- a/src/main/java/com/example/liliyayankova/unirides/User_Register.java +++ b/src/main/java/com/example/liliyayankova/unirides/User_Register.java @@ -4,9 +4,14 @@ import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; +import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; @@ -40,6 +45,18 @@ public class User_Register extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_register); + + //setting the user_toolbar layout as the action bar + Toolbar toolbar = findViewById(R.id.toolbar); + try { + setSupportActionBar(toolbar); + } catch (Exception e) { + Log.e("TOOLBAR", e.toString()); + } + + //makes it so the keyboard doesn't automatically popup! + this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); + this.forename = (EditText) findViewById(R.id.forename); this.surname = (EditText) findViewById(R.id.surname); this.email = (EditText) findViewById(R.id.email); @@ -114,4 +131,30 @@ public class User_Register extends AppCompatActivity { } + //Override for the user_toolbar menu items + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.offline_toolbar_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + //checks the id of the item, if the item id matches a case id then the code in that case block will execute + switch(item.getItemId()){ + + case(R.id.item_settings): + + Intent settings_i = new Intent(User_Register.this, Settings.class); + settings_i.putExtra("userType", Login.userType.NONE); + startActivity(settings_i); + return true; + + } + + return super.onOptionsItemSelected(item); + } + } diff --git a/src/main/res/layout/activity_driver_register.xml b/src/main/res/layout/activity_driver_register.xml index 4c0c21b56bc53853895f756b00ee8f4af46575cc..e539470580a1f03919eaf27fce78fdb181b3c0a5 100644 --- a/src/main/res/layout/activity_driver_register.xml +++ b/src/main/res/layout/activity_driver_register.xml @@ -1,9 +1,12 @@ - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:padding="10dp"> + android:orientation="vertical"> + + <include + android:id="@+id/toolbar" + layout="@layout/user_toolbar" /> + <TextView android:id="@+id/driver_title" @@ -20,7 +23,8 @@ android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" - android:orientation="vertical"> + android:orientation="vertical" + android:padding="10dp"> <EditText android:id="@+id/forename" @@ -85,8 +89,9 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_weight="2" - android:orientation="vertical"> + android:layout_weight="1.7" + android:orientation="vertical" + android:padding="10dp"> <TextView android:id="@+id/tickbox_text" @@ -117,7 +122,7 @@ android:layout_height="wrap_content" android:layout_marginStart="20dp" android:layout_marginEnd="20dp" - android:layout_marginBottom="100dp" + android:layout_marginBottom="10dp" android:background="@color/colorPrimaryDark" android:text="@string/sign" android:textColor="#FFFFFF" /> diff --git a/src/main/res/layout/activity_homepage.xml b/src/main/res/layout/activity_homepage.xml index 97ad14a6fe6fcacfe982a17e22a4cf636d57bdaf..3fb0467506eb9dbf614c929805409810133a8ea0 100644 --- a/src/main/res/layout/activity_homepage.xml +++ b/src/main/res/layout/activity_homepage.xml @@ -8,12 +8,12 @@ android:background="@color/ic_launcher_background" android:gravity="center_horizontal" android:orientation="vertical" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".Login"> + <include + android:id="@+id/toolbar" + layout="@layout/user_toolbar" /> + <ImageView android:id="@+id/imageView4" android:layout_width="wrap_content" diff --git a/src/main/res/layout/activity_login.xml b/src/main/res/layout/activity_login.xml index d6c8087c2edec6488d97cd02acae2a4a9c9d32d7..3c76f7e7b073693c6e9db9dd214d4a826763470c 100644 --- a/src/main/res/layout/activity_login.xml +++ b/src/main/res/layout/activity_login.xml @@ -5,12 +5,12 @@ android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".Login"> + <include + android:id="@+id/toolbar" + layout="@layout/user_toolbar" /> + <!-- Login progress --> <ProgressBar android:id="@+id/login_progress" @@ -25,7 +25,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" - android:foregroundGravity="center"> + android:foregroundGravity="center" + android:padding="10dp"> <LinearLayout android:id="@+id/email_login_form" diff --git a/src/main/res/layout/activity_offline__map.xml b/src/main/res/layout/activity_offline__map.xml index 1d94a67e4818372877e67a0963cabc810f7c2bfc..6482bec24520f2f6ade80a10f140c57752175a67 100644 --- a/src/main/res/layout/activity_offline__map.xml +++ b/src/main/res/layout/activity_offline__map.xml @@ -8,6 +8,10 @@ android:orientation="vertical" tools:context=".Offline_Map"> + <include + android:id="@+id/toolbar" + layout="@layout/user_toolbar" /> + <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" diff --git a/src/main/res/layout/activity_profile.xml b/src/main/res/layout/activity_profile.xml index bc06fdb072032f9a4f57a4f34f834428c11bfe04..46fe79ca6ce7f884b36bc71bb092e39acbcc33fd 100644 --- a/src/main/res/layout/activity_profile.xml +++ b/src/main/res/layout/activity_profile.xml @@ -34,12 +34,12 @@ android:layout_height="match_parent" android:layout_weight="3" android:contentDescription="@string/profile" - app:srcCompat="@drawable/icon_users"/> + app:srcCompat="@drawable/icon_users" /> <ImageView android:id="@+id/picture_taken" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginHorizontal="100dp"/> + android:layout_marginHorizontal="100dp" /> </LinearLayout> \ No newline at end of file diff --git a/src/main/res/layout/activity_register.xml b/src/main/res/layout/activity_register.xml index 7dfedb11734c0a1a5a9b7f154de40598f602a00c..e35c92a6dceaa3ef7f821679fbfe16cf6346c563 100644 --- a/src/main/res/layout/activity_register.xml +++ b/src/main/res/layout/activity_register.xml @@ -7,6 +7,10 @@ android:orientation="vertical" tools:context=".Register"> + <include + android:id="@+id/toolbar" + layout="@layout/user_toolbar" /> + <TextView android:id="@+id/title_text" android:layout_width="match_parent" diff --git a/src/main/res/layout/activity_settings.xml b/src/main/res/layout/activity_settings.xml index 8c32defa6d77eb8b0d06b7f06c82a520079283ac..d55a1a8821027516c667a41cbeb102fb31a8ac6a 100644 --- a/src/main/res/layout/activity_settings.xml +++ b/src/main/res/layout/activity_settings.xml @@ -14,17 +14,95 @@ <TextView android:id="@+id/settings_text" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="match_parent" android:layout_margin="20dp" + android:layout_weight="1.5" android:gravity="center" android:text="@string/settings" android:textSize="30sp" /> - <ImageView - android:id="@+id/settings_image" + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:contentDescription="@string/settings" android:layout_weight="1" - app:srcCompat="@drawable/icon_settings" /> + android:orientation="vertical" + android:padding="10dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_margin="10dp" + android:layout_weight="1" + android:orientation="horizontal"> + + <TextView + android:id="@+id/sound_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/sound" /> + + <ToggleButton + android:id="@+id/sound_toggle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/sound" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_margin="10dp" + android:layout_weight="1" + android:orientation="horizontal"> + + <TextView + android:id="@+id/language_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/language" /> + + <Spinner + android:id="@+id/language_spinner" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_margin="10dp" + android:layout_weight="1" + android:orientation="horizontal"> + + <TextView + android:id="@+id/save_location_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/save_location" /> + + <Spinner + android:id="@+id/save_location_spinner" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + </LinearLayout> + </LinearLayout> + + <Button + android:id="@+id/save_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="20dp" + android:background="@color/colorPrimaryDark" + android:text="@string/save" + android:textColor="@color/common_google_signin_btn_text_dark_default" /> + </LinearLayout> \ No newline at end of file diff --git a/src/main/res/layout/activity_user_register.xml b/src/main/res/layout/activity_user_register.xml index 826e1566778f8fe25e2d1e2817ab098eb4c8128f..ecf00eadc38e8a873a215c42b022054fa4dda8aa 100644 --- a/src/main/res/layout/activity_user_register.xml +++ b/src/main/res/layout/activity_user_register.xml @@ -2,8 +2,11 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:padding="10dp"> + android:orientation="vertical"> + + <include + android:id="@+id/toolbar" + layout="@layout/user_toolbar" /> <TextView android:id="@+id/user_title" @@ -20,6 +23,7 @@ android:layout_height="match_parent" android:layout_weight="1.2" android:gravity="center" + android:padding="10dp" android:orientation="vertical"> <EditText @@ -65,6 +69,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="2" + android:padding="10dp" android:orientation="vertical"> <TextView @@ -96,7 +101,7 @@ android:layout_height="wrap_content" android:layout_marginStart="20dp" android:layout_marginEnd="20dp" - android:layout_marginBottom="100dp" + android:layout_marginBottom="10dp" android:background="@color/colorPrimary" android:text="@string/sign" android:textColor="#FFFFFF" /> diff --git a/src/main/res/menu/offline_toolbar_menu.xml b/src/main/res/menu/offline_toolbar_menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..032097545ddaaec52b3e36030378a1c45a7aa10d --- /dev/null +++ b/src/main/res/menu/offline_toolbar_menu.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:android="http://schemas.android.com/apk/res/android"> + + + <item + android:id="@+id/item_settings" + android:contentDescription="@string/settings" + android:icon="@drawable/icon_settings" + android:orderInCategory="3" + android:title="@string/settings" + app:showAsAction="ifRoom" /> + + + +</menu> \ No newline at end of file diff --git a/src/main/res/menu/toolbar_menu.xml b/src/main/res/menu/toolbar_menu.xml index 39e75e66a4b92f436991db68e250e35b236d3ad6..a19f7e97c812349c91bf95712dc2e2154bf65f84 100644 --- a/src/main/res/menu/toolbar_menu.xml +++ b/src/main/res/menu/toolbar_menu.xml @@ -8,7 +8,7 @@ android:icon="@drawable/ic_home_black_24dp" android:orderInCategory="1" android:title="@string/home" - app:showAsAction="ifRoom" /> + app:showAsAction="always" /> <item android:id="@+id/item_profile" @@ -16,14 +16,15 @@ android:icon="@drawable/icon_users" android:orderInCategory="2" android:title="@string/profile" - app:showAsAction="ifRoom" /> + app:showAsAction="always" /> <item android:id="@+id/item_settings" android:contentDescription="@string/settings" + android:icon="@drawable/icon_settings" android:orderInCategory="3" android:title="@string/settings" - app:showAsAction="never" /> + app:showAsAction="always" /> <item android:id="@+id/item_logout" diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a0229542111dce4aeaae65de8bb1a362cfd1d5c5..8fe743463298370bf08a6fad3dfee31b17145ab5 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -55,6 +55,22 @@ <string name="offline_map">Offline Map</string> <string name="back">Back</string> + <!-- settings activity strings --> + <string name="language">Language</string> + <string name="sound">Sound</string> + <string name="save_location">Save Location</string> + <string name="save">Save</string> + + <!-- spinner values for LANGUAGE --> + <string-array name="languages"> + <item>English</item> + </string-array> + + <!-- spinner values for SAVE_LOCATION --> + <string-array name="save_locations"> + <item>Device</item> + <item>SD Card</item> + </string-array> <!-- Free for commercial use icon credit for any file in drawable with the "icon_" keyword--> <string name="icon_credit">Icons made by Smashicons and Roundicons</string>