new profile ui #134

Merged
s416084 merged 5 commits from newProfile into develop 2019-01-06 21:14:51 +01:00
7 changed files with 54 additions and 36 deletions

View File

@ -29,7 +29,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -10,8 +10,8 @@ android {
applicationId "com.uam.wmi.findmytutor" applicationId "com.uam.wmi.findmytutor"
minSdkVersion 22 minSdkVersion 22
targetSdkVersion 27 targetSdkVersion 27
versionCode 37 versionCode 40
versionName "0.9.6-beta" versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }

View File

@ -266,7 +266,6 @@ public abstract class BaseActivity
setUpNav(); setUpNav();
actionBarDrawerToggle.syncState(); actionBarDrawerToggle.syncState();
} }
@Override @Override
@ -423,7 +422,7 @@ public abstract class BaseActivity
} }
private void updateNavigationBarState() { public void updateNavigationBarState() {
int actionId = getNavigationMenuItemId(); int actionId = getNavigationMenuItemId();
selectBottomNavigationBarItem(actionId); selectBottomNavigationBarItem(actionId);
} }

View File

@ -6,6 +6,7 @@ import android.app.FragmentTransaction;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
@ -270,11 +271,10 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.hide(SharingFragment.this); fragmentTransaction.hide(SharingFragment.this);
fragmentTransaction.commit(); fragmentTransaction.commit();
((MapActivity) getActivity()).updateNavigationBarState();
return true; return true;
}); });
statusSwitch.setOnPreferenceChangeListener((preference, newValue) -> { statusSwitch.setOnPreferenceChangeListener((preference, newValue) -> true);
return true;
});
/** Status list change listener **/ /** Status list change listener **/
statusList.setOnPreferenceChangeListener((preference, newValue) -> { statusList.setOnPreferenceChangeListener((preference, newValue) -> {
ListPreference lp = (ListPreference) preference; ListPreference lp = (ListPreference) preference;

View File

@ -231,6 +231,7 @@ public class UsersListFragment extends Fragment {
List<User> list = new ArrayList<User>(); List<User> list = new ArrayList<User>();
list.add(user); list.add(user);
((MapActivity) getActivity()).filterMarkers(list); ((MapActivity) getActivity()).filterMarkers(list);
((MapActivity) getActivity()).updateNavigationBarState();
}); });
} }
alertDialog = alertDialogBuilderUserInput.create(); alertDialog = alertDialogBuilderUserInput.create();

View File

@ -17,15 +17,38 @@ public class RightButtonPreference extends Preference {
public RightButtonPreference(Context context, AttributeSet attrs) { public RightButtonPreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setWidgetLayoutResource(R.layout.preference_button_widget); setWidgetLayoutResource(R.layout.preference_button_widget);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs){
for (int i=0;i<attrs.getAttributeCount();i++) { for (int i=0;i<attrs.getAttributeCount();i++) {
String attr = attrs.getAttributeName(i); String attr = attrs.getAttributeName(i);
String val = attrs.getAttributeValue(i); try {
if (attr.equalsIgnoreCase("text")) { if(attr.equalsIgnoreCase("key")){
buttonText = context.getResources().getString(Integer.parseInt(val.substring(1))); Log.e("BUTTON_ERR",attr);
} String val = attrs.getAttributeValue(i);
}
switch (val) {
case "remove_manual_status":
buttonText = context.getResources().getString(R.string.preference_manual_location_button_remove);
break;
case "manual_location_button":
buttonText = context.getResources().getString(R.string.preference_manual_location_button);
break;
case "remove_manual_location":
buttonText = context.getResources().getString(R.string.preference_manual_location_button_remove);
break;
}
}
} catch (Exception e) {
buttonText = "";
Log.e("BUTTON_ERR", String.valueOf(e));
}
}
} }
public void setText(String text){ public void setText(String text){
prefButton.setText(text); prefButton.setText(text);
} }

View File

@ -1,20 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:tools="http://schemas.android.com/tools" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/pref_screen" android:id="@+id/pref_screen"
android:fontFamily="@font/lato_regular" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:fontFamily="@font/lato_regular">
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_category_location" android:key="category_sharing"
android:key="category_sharing"> android:title="@string/settings_category_location">
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:disableDependentsState="false" android:disableDependentsState="false"
android:key="key_sharing_enabled" android:key="key_sharing_enabled"
android:persistent="true" android:persistent="true"
android:title="@string/title_sharing"/> android:title="@string/title_sharing" />
<ListPreference <ListPreference
android:defaultValue="2" android:defaultValue="2"
android:dialogTitle="@string/settings_location_level" android:dialogTitle="@string/settings_location_level"
@ -25,45 +24,41 @@
android:title="@string/title_location_level" /> android:title="@string/title_location_level" />
<ListPreference <ListPreference
android:defaultValue="0" android:defaultValue="0"
android:key="key_manual_location_value"
android:summary="%s"
android:entries="@array/manual_location_entries" android:entries="@array/manual_location_entries"
android:entryValues="@array/manual_location_values" android:entryValues="@array/manual_location_values"
android:key="key_manual_location_value"
android:summary="%s"
android:title="@string/title_list_manual_location" /> android:title="@string/title_list_manual_location" />
<com.uam.wmi.findmytutor.utils.RightButtonPreference <com.uam.wmi.findmytutor.utils.RightButtonPreference
android:key="manual_location_button" android:key="manual_location_button"
android:text="@string/preference_manual_location_button" android:text="@string/preference_manual_location_button" />
/>
<com.uam.wmi.findmytutor.utils.RightButtonPreference <com.uam.wmi.findmytutor.utils.RightButtonPreference
android:key="remove_manual_location" android:key="remove_manual_location"
android:text="@string/preference_manual_location_button_remove" android:text="@string/preference_manual_location_button_remove" />
/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_status"> <PreferenceCategory android:title="@string/settings_category_status">
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:disableDependentsState="false" android:disableDependentsState="false"
android:key="key_status_enabled" android:key="key_status_enabled"
android:persistent="true" android:persistent="true"
android:title="@string/status_switch_title"/> android:title="@string/status_switch_title" />
<ListPreference <ListPreference
android:defaultValue="0" android:defaultValue="0"
android:key="@string/key_status_value"
android:summary="%s"
android:entries="@array/status_entries" android:entries="@array/status_entries"
android:entryValues="@array/status_values" android:entryValues="@array/status_values"
android:key="@string/key_status_value"
android:summary="%s"
android:title="@string/status_list_title" /> android:title="@string/status_list_title" />
<EditTextPreference <EditTextPreference
android:key="key_manual_status" android:key="key_manual_status"
android:selectAllOnFocus="true" android:selectAllOnFocus="true"
android:singleLine="true" android:singleLine="true"
android:title="@string/title_manual_status" android:title="@string/title_manual_status" />
/>
<com.uam.wmi.findmytutor.utils.RightButtonPreference <com.uam.wmi.findmytutor.utils.RightButtonPreference
android:key="remove_manual_status" android:key="remove_manual_status"
android:text="@string/preference_manual_status_button_remove" android:text="@string/preference_manual_status_button_remove" />
/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>