blob: 9476e3780f0598126e666f2fe1b7e59b9847635a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package cgeo.geocaching.settings;
import cgeo.geocaching.twitter.TwitterAuthorizationActivity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
public class AuthorizeTwitterPreference extends Preference {
public AuthorizeTwitterPreference(Context context) {
super(context);
}
public AuthorizeTwitterPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AuthorizeTwitterPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected View onCreateView(ViewGroup parent) {
setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent authIntent = new Intent(preference.getContext(),
TwitterAuthorizationActivity.class);
((Activity) preference.getContext()).startActivity(authIntent);
return false; // no shared preference has to be changed
}
});
return super.onCreateView(parent);
}
}
|