paramterize about activity title

This commit is contained in:
Daniel Gultsch 2018-11-08 13:02:14 +01:00
parent e450626d5c
commit 41b9c0de55
5 changed files with 10 additions and 12 deletions

View file

@ -209,7 +209,6 @@
android:windowSoftInputMode="stateAlwaysHidden"/> android:windowSoftInputMode="stateAlwaysHidden"/>
<activity <activity
android:name=".ui.AboutActivity" android:name=".ui.AboutActivity"
android:label="@string/title_activity_about"
android:parentActivityName=".ui.SettingsActivity"> android:parentActivityName=".ui.SettingsActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"

View file

@ -20,5 +20,7 @@ public class AboutActivity extends AppCompatActivity {
setContentView(R.layout.activity_about); setContentView(R.layout.activity_about);
setSupportActionBar(findViewById(R.id.toolbar)); setSupportActionBar(findViewById(R.id.toolbar));
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
setTitle(getString(R.string.title_activity_about_x, getString(R.string.app_name
)));
} }
} }

View file

@ -11,12 +11,16 @@ import eu.siacs.conversations.utils.PhoneHelper;
public class AboutPreference extends Preference { public class AboutPreference extends Preference {
public AboutPreference(final Context context, final AttributeSet attrs, final int defStyle) { public AboutPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
setSummary(); final String appName = context.getString(R.string.app_name);
setSummary(appName +' '+ PhoneHelper.getVersionName(context));
setTitle(context.getString(R.string.title_activity_about_x, appName));
} }
public AboutPreference(final Context context, final AttributeSet attrs) { public AboutPreference(final Context context, final AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setSummary(); final String appName = context.getString(R.string.app_name);
setSummary(appName +' '+ PhoneHelper.getVersionName(context));
setTitle(context.getString(R.string.title_activity_about_x, appName));
} }
@Override @Override
@ -25,9 +29,5 @@ public class AboutPreference extends Preference {
final Intent intent = new Intent(getContext(), AboutActivity.class); final Intent intent = new Intent(getContext(), AboutActivity.class);
getContext().startActivity(intent); getContext().startActivity(intent);
} }
private void setSummary() {
setSummary(getContext().getString(R.string.app_name) +' '+ PhoneHelper.getVersionName(getContext()));
}
} }

View file

@ -268,8 +268,7 @@
<string name="pref_allow_message_correction_summary">Allow your contacts to retroactively edit their messages</string> <string name="pref_allow_message_correction_summary">Allow your contacts to retroactively edit their messages</string>
<string name="pref_expert_options">Expert settings</string> <string name="pref_expert_options">Expert settings</string>
<string name="pref_expert_options_summary">Please be careful with these</string> <string name="pref_expert_options_summary">Please be careful with these</string>
<string name="title_activity_about">About Conversations</string> <string name="title_activity_about_x">About %s</string>
<string name="pref_about_conversations_summary">Build and licensing information</string>
<string name="title_pref_quiet_hours">Quiet Hours</string> <string name="title_pref_quiet_hours">Quiet Hours</string>
<string name="title_pref_quiet_hours_start_time">Start time</string> <string name="title_pref_quiet_hours_start_time">Start time</string>
<string name="title_pref_quiet_hours_end_time">End time</string> <string name="title_pref_quiet_hours_end_time">End time</string>

View file

@ -342,7 +342,5 @@
android:summary="@string/pref_never_send_crash_summary" android:summary="@string/pref_never_send_crash_summary"
android:title="@string/pref_never_send_crash" /> android:title="@string/pref_never_send_crash" />
</PreferenceCategory> </PreferenceCategory>
<eu.siacs.conversations.ui.AboutPreference <eu.siacs.conversations.ui.AboutPreference/>
android:summary="@string/pref_about_conversations_summary"
android:title="@string/title_activity_about" />
</PreferenceScreen> </PreferenceScreen>