|
|
|
|
@ -15,6 +15,8 @@ import android.widget.LinearLayout;
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
import com.timsu.astrid.R;
|
|
|
|
|
import com.todoroo.astrid.service.StatisticsConstants;
|
|
|
|
|
import com.todoroo.astrid.service.StatisticsService;
|
|
|
|
|
import com.todoroo.astrid.service.ThemeService;
|
|
|
|
|
|
|
|
|
|
public class ShareActivity extends FragmentActivity {
|
|
|
|
|
@ -34,23 +36,24 @@ public class ShareActivity extends FragmentActivity {
|
|
|
|
|
|
|
|
|
|
setContentView(R.layout.share_activity);
|
|
|
|
|
TextView fb = (TextView) findViewById(R.id.share_facebook);
|
|
|
|
|
setUpTextView(fb, getString(R.string.share_with_facebook), "http://facebook.com/weloveastrid"); //$NON-NLS-1$
|
|
|
|
|
setUpTextView(fb, getString(R.string.share_with_facebook), "http://facebook.com/weloveastrid", "facebook"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
|
|
|
|
|
|
TextView twitter = (TextView) findViewById(R.id.share_twitter);
|
|
|
|
|
setUpTextView(twitter, getString(R.string.share_with_twitter), "http://twitter.com/#!/weloveastrid"); //$NON-NLS-1$
|
|
|
|
|
setUpTextView(twitter, getString(R.string.share_with_twitter), "http://twitter.com/#!/weloveastrid", "twitter"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
|
|
|
|
|
|
TextView google = (TextView) findViewById(R.id.share_google);
|
|
|
|
|
setUpTextView(google, getString(R.string.share_with_google), "https://plus.google.com/116404018347675245869"); //$NON-NLS-1$
|
|
|
|
|
setUpTextView(google, getString(R.string.share_with_google), "https://plus.google.com/116404018347675245869", "google"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
|
|
|
|
|
|
setupText();
|
|
|
|
|
|
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.SHARE_PAGE_VIEWED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setUpTextView(TextView tv, String text, final String url) {
|
|
|
|
|
private void setUpTextView(TextView tv, String text, final String url, final String buttonId) {
|
|
|
|
|
tv.setText(text);
|
|
|
|
|
((View) tv.getParent()).setOnClickListener(new OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.SHARE_BUTTON_CLICKED, "button", buttonId); //$NON-NLS-1$
|
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
}
|
|
|
|
|
|