anotherim/src/main/java/eu/siacs/conversations/ui/AboutPreference.java

36 lines
1.1 KiB
Java
Raw Normal View History

2014-10-22 02:53:30 +00:00
package eu.siacs.conversations.ui;
import android.content.Context;
2014-11-04 17:08:30 +00:00
import android.content.Intent;
import android.preference.Preference;
2014-10-22 02:53:30 +00:00
import android.util.AttributeSet;
2021-04-30 08:54:36 +00:00
import eu.siacs.conversations.BuildConfig;
import eu.siacs.conversations.R;
2015-02-16 09:06:09 +00:00
import eu.siacs.conversations.utils.PhoneHelper;
2014-11-04 17:08:30 +00:00
public class AboutPreference extends Preference {
public AboutPreference(final Context context, final AttributeSet attrs, final int defStyle) {
2014-10-22 02:53:30 +00:00
super(context, attrs, defStyle);
2021-04-30 08:54:36 +00:00
setSummaryAndTitle(context);
2014-10-22 02:53:30 +00:00
}
2014-11-04 17:08:30 +00:00
public AboutPreference(final Context context, final AttributeSet attrs) {
2014-10-22 02:53:30 +00:00
super(context, attrs);
2021-04-30 08:54:36 +00:00
setSummaryAndTitle(context);
2014-10-22 02:53:30 +00:00
}
2021-04-30 08:54:36 +00:00
private void setSummaryAndTitle(final Context context) {
setSummary(String.format("%s %s", BuildConfig.APP_NAME, BuildConfig.VERSION_NAME));
setTitle(context.getString(R.string.title_activity_about_x, BuildConfig.APP_NAME));
}
2014-11-04 17:08:30 +00:00
@Override
protected void onClick() {
super.onClick();
final Intent intent = new Intent(getContext(), AboutActivity.class);
getContext().startActivity(intent);
}
2014-10-22 02:53:30 +00:00
}