new profile ui #134

Merged
s416084 merged 5 commits from newProfile into develop 2019-01-06 21:14:51 +01:00
3 changed files with 48 additions and 30 deletions
Showing only changes of commit 8ab7e526e6 - Show all commits

View File

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

View File

@ -17,15 +17,38 @@ public class RightButtonPreference extends Preference {
public RightButtonPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setWidgetLayoutResource(R.layout.preference_button_widget);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs){
for (int i=0;i<attrs.getAttributeCount();i++) {
String attr = attrs.getAttributeName(i);
String val = attrs.getAttributeValue(i);
if (attr.equalsIgnoreCase("text")) {
buttonText = context.getResources().getString(Integer.parseInt(val.substring(1)));
}
}
try {
if(attr.equalsIgnoreCase("key")){
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){
prefButton.setText(text);
}

View File

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