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" 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

@ -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>