mobile: moved about to settings activity

This commit is contained in:
Philipp Schaefer
2013-04-09 22:03:33 +02:00
parent 2287b09f17
commit 81857a3812
5 changed files with 64 additions and 38 deletions

View File

@@ -0,0 +1,46 @@
package com.cradle.iitc_mobile;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.preference.DialogPreference;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.AttributeSet;
import android.widget.TextView;
public class IITC_AboutDialogPreference extends DialogPreference{
private Context context;
public IITC_AboutDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
/*
* start a little about-dialog
* srsly...I found no better way for clickable links in a TextView then
* using Html.fromHtml...Linkify ist just broken and does not understand
* html href tags...so let's tag the @string/about_msg with CDATA and
* use Html.fromHtml(...) for clickable hrefs with tags.
*/
@Override
protected void onPrepareDialogBuilder(Builder builder) {
final TextView message = new TextView(context);
String about_msg = context.getText(R.string.pref_about_msg).toString();
message.setText(Html.fromHtml(about_msg));
message.setMovementMethod(LinkMovementMethod.getInstance());
builder.setView(message)
.setTitle(R.string.about)
.setIcon(R.drawable.ic_stat_about)
.setNeutralButton(R.string.close, new OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
super.onPrepareDialogBuilder(builder);
}
}