mirror of https://github.com/tasks/tasks
Removing some preferences and welcome walkthrough
* Remove Account Info * Remove Support (Tutorial, FAQ, about) * Remove Share Astrid
parent
41a8dbe07c
commit
d9a7d8cd81
@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#eee">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="20dip"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/share_facebook"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_facebook"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?attr/asThemeTextColor"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/share_twitter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_twitter"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?attr/asThemeTextColor"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="20dip">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/share_google"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_google"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?attr/asThemeTextColor"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/astrid_speech_bubble"/>
|
||||
|
||||
</LinearLayout>
|
||||
@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#eee">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="50dip"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/share_facebook"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_facebook"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?attr/asThemeTextColor"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/share_twitter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_twitter"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?attr/asThemeTextColor"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="50dip">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/share_google"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_google"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?attr/asThemeTextColor"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/astrid_speech_bubble"/>
|
||||
|
||||
</LinearLayout>
|
||||
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:paddingTop="3dip"
|
||||
android:paddingBottom="3dip"
|
||||
android:background="#55000000"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.viewpagerindicator.CirclePageIndicator
|
||||
android:id="@+id/indicator"
|
||||
android:padding="15dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:background="#00000000"
|
||||
style="@style/CustomCirclePageIndicator"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dip"
|
||||
android:text="@string/welcome_next"
|
||||
android:textColor="#444444"
|
||||
android:textSize="20dip"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="10dip"
|
||||
android:shadowRadius="2"
|
||||
android:shadowDy="1"
|
||||
android:shadowColor="@android:color/white"/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@ -1,119 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="4dip"
|
||||
android:paddingRight="4dip"
|
||||
android:background="#d0d0d0"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="110dip"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingBottom="10dip"
|
||||
android:layout_marginTop="30dip"
|
||||
android:text="@string/welcome_title_7"
|
||||
android:textColor="#444444"
|
||||
android:textSize="40dip"
|
||||
android:textStyle="bold"
|
||||
android:shadowRadius="2"
|
||||
android:shadowDy="1"
|
||||
android:shadowColor="@android:color/white"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#ff0000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="253dp"
|
||||
android:paddingTop="5dip">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tos"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="35dip"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingRight="20dip"
|
||||
android:textSize="12.5sp"
|
||||
android:textColor="#444444"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/gg_login"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dip"
|
||||
android:layout_below="@id/tos"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingRight="20dip"
|
||||
android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip"
|
||||
android:textSize="16sp"
|
||||
android:drawableLeft="@drawable/google"
|
||||
android:text="@string/actfm_ALA_gg_login"/>
|
||||
|
||||
<com.facebook.android.LoginButton
|
||||
android:id="@+id/fb_login"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dip"
|
||||
android:layout_below="@id/gg_login"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingRight="20dip"
|
||||
android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip"
|
||||
android:textSize="16sp"
|
||||
android:drawableLeft="@drawable/facebook"
|
||||
android:text="@string/actfm_ALA_fb_login"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/pw_signup"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dip"
|
||||
android:layout_below="@id/fb_login"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingRight="20dip"
|
||||
android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/welcome_login_pw"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pw_login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dip"
|
||||
android:gravity="center"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/pw_signup"
|
||||
android:textColor="#444"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/welcome_sign_in"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_later"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dip"
|
||||
android:gravity="center"
|
||||
android:layout_below="@id/pw_login"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingRight="20dip"
|
||||
android:paddingBottom="5dip"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/welcome_login_later"
|
||||
android:textColor="#444444"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#d0d0d0">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome_walkthrough_title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="27dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Hello"
|
||||
android:textColor="#444444"
|
||||
android:textSize="40dip"
|
||||
android:textStyle="bold"
|
||||
android:shadowRadius="2"
|
||||
android:shadowDy="1"
|
||||
android:shadowColor="@android:color/white"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/welcome_walkthrough_image"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/welcome_walkthrough_1"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome_walkthrough_body"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Hello"
|
||||
android:textColor="#444444"
|
||||
android:textSize="20dip"
|
||||
android:textStyle="bold"
|
||||
android:shadowRadius="2"
|
||||
android:shadowDy="1"
|
||||
android:shadowColor="@android:color/white"/>
|
||||
|
||||
</LinearLayout>
|
||||
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/astrid_com_gradient"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="39dip"
|
||||
android:src="@drawable/astrid_com_logo_new"
|
||||
android:scaleType="center"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/quick_login_google"
|
||||
android:layout_width="280dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="45dip"
|
||||
android:textSize="16sp"
|
||||
android:background="@drawable/google_login_background"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginBottom="15dip"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quick_login_reject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dip"
|
||||
android:layout_marginBottom="70dip"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/white"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dip"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:textColor="#ff0000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</LinearLayout>
|
||||
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.todoroo.astrid.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.res.Resources;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.timsu.astrid.R;
|
||||
|
||||
/**
|
||||
* Displays an About dialog.
|
||||
*/
|
||||
class About {
|
||||
/**
|
||||
* Displays the About dialog from the settings menu.
|
||||
*
|
||||
* @param activity For context.
|
||||
*/
|
||||
@SuppressWarnings("nls")
|
||||
public static void showAbout(final Activity activity, final String versionName) {
|
||||
|
||||
Resources r = activity.getResources();
|
||||
|
||||
StringBuilder aboutText = new StringBuilder();
|
||||
aboutText.append("<b>").append(r.getString(R.string.app_name)).append("</b><br />").
|
||||
append(r.getString(R.string.p_about_text, versionName).replace("\n", "<br />")).append("<br /><br />").
|
||||
append("<a href='http://github.com/todoroo/astrid'>Source Code</a><br />").
|
||||
append("<a href='http://astrid.com/privacy'>Privacy Policy</a><br />").
|
||||
append("<a href='http://astrid.com/terms'>Terms of Use</a><br /><br />").
|
||||
append("Visit <a href='http://astrid.com'>astrid.com</a> " +
|
||||
"for more information, to add translations or help make Astrid better!");
|
||||
|
||||
final AlertDialog.Builder d = new AlertDialog.Builder(activity);
|
||||
|
||||
Spanned body = Html.fromHtml(aboutText.toString());
|
||||
TextView textView = new TextView(activity);
|
||||
textView.setText(body);
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
textView.setPadding(5, 0, 5, 0);
|
||||
|
||||
d.setIcon(android.R.drawable.ic_dialog_info);
|
||||
d.setView(textView);
|
||||
d.setTitle(r.getString(R.string.p_about));
|
||||
d.show();
|
||||
}
|
||||
|
||||
private About() {
|
||||
// don't construct me
|
||||
}
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
package com.todoroo.astrid.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.timsu.astrid.R;
|
||||
import com.todoroo.astrid.service.ThemeService;
|
||||
|
||||
public class ShareActivity extends SherlockFragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
ThemeService.applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
actionBar.setCustomView(R.layout.header_title_view);
|
||||
((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.EPr_share_astrid);
|
||||
|
||||
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", "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/astrid", "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", "google"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
setupText();
|
||||
}
|
||||
|
||||
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) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupText() {
|
||||
View speechBubbleBackground = findViewById(R.id.speech_bubble_container);
|
||||
speechBubbleBackground.setBackgroundColor(0);
|
||||
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
ImageView icon = (ImageView) findViewById(R.id.astridIcon);
|
||||
|
||||
int dim = (int) (80 * metrics.density);
|
||||
icon.setLayoutParams(new LinearLayout.LayoutParams(dim, dim));
|
||||
icon.setScaleType(ScaleType.FIT_CENTER);
|
||||
|
||||
TextView speechBubble = (TextView) findViewById(R.id.reminder_message);
|
||||
|
||||
speechBubble.setText(R.string.share_speech_bubble);
|
||||
speechBubble.setTextSize(17);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,194 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.welcome.tutorial;
|
||||
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.Context;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
|
||||
import com.timsu.astrid.R;
|
||||
import com.todoroo.andlib.service.Autowired;
|
||||
import com.todoroo.andlib.service.DependencyInjectionService;
|
||||
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
|
||||
import com.todoroo.astrid.utility.Constants;
|
||||
import com.viewpagerindicator.TitleProvider;
|
||||
|
||||
public class WelcomePagerAdapter extends PagerAdapter implements TitleProvider {
|
||||
private int[] images = new int[]{
|
||||
R.drawable.welcome_walkthrough_1,
|
||||
R.drawable.welcome_walkthrough_2,
|
||||
R.drawable.welcome_walkthrough_3,
|
||||
R.drawable.welcome_walkthrough_4,
|
||||
R.drawable.welcome_walkthrough_5,
|
||||
R.drawable.welcome_walkthrough_6,
|
||||
0
|
||||
};
|
||||
private int[] title = new int[]{
|
||||
R.string.welcome_title_1,
|
||||
R.string.welcome_title_2,
|
||||
R.string.welcome_title_3,
|
||||
R.string.welcome_title_4,
|
||||
R.string.welcome_title_5,
|
||||
R.string.welcome_title_6,
|
||||
R.string.welcome_title_7,
|
||||
};
|
||||
private int[] body = new int[]{
|
||||
R.string.welcome_body_1,
|
||||
R.string.welcome_body_2,
|
||||
R.string.welcome_body_3,
|
||||
R.string.welcome_body_4,
|
||||
R.string.welcome_body_5,
|
||||
R.string.welcome_body_6,
|
||||
R.string.welcome_body_7,
|
||||
};
|
||||
public int[] layouts = new int[]{
|
||||
R.layout.welcome_walkthrough_page,
|
||||
R.layout.welcome_walkthrough_page,
|
||||
R.layout.welcome_walkthrough_page,
|
||||
R.layout.welcome_walkthrough_page,
|
||||
R.layout.welcome_walkthrough_page,
|
||||
R.layout.welcome_walkthrough_page,
|
||||
R.layout.actfm_login_activity,
|
||||
};
|
||||
|
||||
public int fallbackLoginPage;
|
||||
|
||||
private final Context context;
|
||||
public Account[] accounts;
|
||||
public WelcomeWalkthrough parent;
|
||||
@Autowired
|
||||
ActFmPreferenceService actFmPreferenceService;
|
||||
|
||||
public WelcomePagerAdapter(Context context, boolean manual) {
|
||||
this.context = context;
|
||||
DependencyInjectionService.getInstance().inject(this);
|
||||
|
||||
accounts = null;
|
||||
try {
|
||||
GoogleAccountManager am = new GoogleAccountManager(context);
|
||||
accounts = am.getAccounts();
|
||||
} catch (Exception e) {
|
||||
//
|
||||
}
|
||||
|
||||
if (manual) {
|
||||
layouts[layouts.length - 1] = R.layout.welcome_walkthrough_page;
|
||||
title[title.length - 1] = R.string.welcome_title_7_return;
|
||||
images[images.length - 1] = R.drawable.welcome_walkthrough_1;
|
||||
body[body.length - 1] = R.string.welcome_body_7_return;
|
||||
fallbackLoginPage = R.layout.actfm_login_activity;
|
||||
} else {
|
||||
if (Constants.ASTRID_LITE) {
|
||||
adjustResourcesForLite();
|
||||
}
|
||||
|
||||
// Setup login page from AB tests
|
||||
fallbackLoginPage = layouts[layouts.length - 1];
|
||||
if (accounts != null && accounts.length > 0) { // If has google account
|
||||
layouts[layouts.length - 1] = R.layout.welcome_walkthrough_simple_login;
|
||||
fallbackLoginPage = R.layout.actfm_login_activity;
|
||||
} else { // If no google account
|
||||
fallbackLoginPage = layouts[layouts.length - 1] = R.layout.actfm_login_activity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void adjustResourcesForLite() {
|
||||
images = new int[]{0};
|
||||
title = new int[]{R.string.welcome_title_7};
|
||||
body = new int[]{R.string.welcome_body_7};
|
||||
layouts = new int[]{R.layout.actfm_login_activity};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrimaryItem(ViewGroup container, int position, Object object) {
|
||||
super.setPrimaryItem(container, position, object);
|
||||
|
||||
parent.onPageChanged(container, position);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return layouts.length;
|
||||
}
|
||||
|
||||
public void changeLoginPage(int newLayout) {
|
||||
layouts[layouts.length - 1] = newLayout;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(final View pager, final int position) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
|
||||
View pageView = inflater.inflate(layouts[position], null, true);
|
||||
pageView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
WindowManager.LayoutParams.MATCH_PARENT));
|
||||
|
||||
if (pageView.findViewById(R.id.welcome_walkthrough_image) != null) {
|
||||
ImageView imageView = (ImageView) pageView.findViewById(R.id.welcome_walkthrough_image);
|
||||
imageView.setImageResource(images[position]);
|
||||
|
||||
TextView titleView = (TextView) pageView.findViewById(R.id.welcome_walkthrough_title);
|
||||
titleView.setText(title[position]);
|
||||
|
||||
TextView bodyView = (TextView) pageView.findViewById(R.id.welcome_walkthrough_body);
|
||||
bodyView.setText(body[position]);
|
||||
}
|
||||
|
||||
((ViewPager) pager).addView(pageView, 0);
|
||||
parent.instantiatePage(position);
|
||||
return pageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(View pager, int position, Object view) {
|
||||
((ViewPager) pager).removeView((View) view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view.equals(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishUpdate(View view) {
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreState(Parcelable p, ClassLoader c) {
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parcelable saveState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startUpdate(View view) {
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(int position) {
|
||||
return context.getString(title[position]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,268 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
|
||||
package com.todoroo.astrid.welcome.tutorial;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AccountManagerCallback;
|
||||
import android.accounts.AccountManagerFuture;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
|
||||
import com.timsu.astrid.R;
|
||||
import com.todoroo.andlib.utility.DialogUtilities;
|
||||
import com.todoroo.astrid.actfm.ActFmGoogleAuthActivity;
|
||||
import com.todoroo.astrid.actfm.ActFmLoginActivity;
|
||||
import com.viewpagerindicator.CirclePageIndicator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class WelcomeWalkthrough extends ActFmLoginActivity {
|
||||
private ViewPager mPager;
|
||||
private WelcomePagerAdapter mAdapter;
|
||||
private Account[] accounts;
|
||||
private CirclePageIndicator mIndicator;
|
||||
private View currentView;
|
||||
|
||||
private String authToken;
|
||||
private boolean onSuccess = false;
|
||||
private boolean dismissDialog = false;
|
||||
|
||||
public static final String KEY_SHOWED_WELCOME_LOGIN = "key_showed_welcome_login"; //$NON-NLS-1$
|
||||
|
||||
public static final String TOKEN_MANUAL_SHOW = "manual"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mAdapter = new WelcomePagerAdapter(this, getIntent().hasExtra(TOKEN_MANUAL_SHOW));
|
||||
mAdapter.parent = this;
|
||||
accounts = mAdapter.accounts;
|
||||
|
||||
mPager = (ViewPager) findViewById(R.id.pager);
|
||||
mPager.setAdapter(mAdapter);
|
||||
|
||||
mIndicator = (CirclePageIndicator) findViewById(R.id.indicator);
|
||||
mIndicator.setViewPager(mPager);
|
||||
if (mAdapter.getCount() <= 1) {
|
||||
mIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getContentViewResource() {
|
||||
return R.layout.welcome_walkthrough;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTitleResource() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void instantiatePage(int position) {
|
||||
if (position == mAdapter.getCount() - 1) {
|
||||
initializeUI();
|
||||
}
|
||||
}
|
||||
|
||||
private int getLoginPageLayout() {
|
||||
return mAdapter.fallbackLoginPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeUI() {
|
||||
String email = null;
|
||||
if (accounts != null && accounts.length > 0 && !TextUtils.isEmpty(accounts[0].name)) {
|
||||
email = accounts[0].name;
|
||||
}
|
||||
Button simpleLogin = (Button) findViewById(R.id.quick_login_google);
|
||||
if (simpleLogin != null && !TextUtils.isEmpty(email)) {
|
||||
initializeSimpleUI(email);
|
||||
} else {
|
||||
if (mAdapter != null && mAdapter.layouts[mAdapter.layouts.length - 1] != getLoginPageLayout()) {
|
||||
mAdapter.changeLoginPage(getLoginPageLayout());
|
||||
}
|
||||
super.initializeUI();
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeSimpleUI(final String email) {
|
||||
Button simpleLogin = (Button) findViewById(R.id.quick_login_google);
|
||||
simpleLogin.setText(getString(R.string.actfm_quick_login, email));
|
||||
simpleLogin.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final ProgressDialog pd = DialogUtilities.progressDialog(WelcomeWalkthrough.this, getString(R.string.gtasks_GLA_authenticating));
|
||||
pd.show();
|
||||
getAuthToken(email, pd);
|
||||
}
|
||||
|
||||
private void getAuthToken(final String e,
|
||||
final ProgressDialog pd) {
|
||||
final GoogleAccountManager accountManager = new GoogleAccountManager(WelcomeWalkthrough.this);
|
||||
Account a = accountManager.getAccountByName(e);
|
||||
AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
|
||||
@Override
|
||||
public void run(final AccountManagerFuture<Bundle> future) {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Bundle bundle = future.getResult(30, TimeUnit.SECONDS);
|
||||
if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
|
||||
authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
|
||||
if (!onSuccess) {
|
||||
accountManager.manager.invalidateAuthToken(ActFmGoogleAuthActivity.AUTH_TOKEN_TYPE, authToken);
|
||||
getAuthToken(e, pd);
|
||||
onSuccess = true;
|
||||
} else {
|
||||
onAuthTokenSuccess(e, authToken);
|
||||
dismissDialog = true;
|
||||
}
|
||||
} else {
|
||||
dismissDialog = true;
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
Log.e("actfm-google-auth", "Login Error", e); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int error = e instanceof IOException ? R.string.gtasks_GLA_errorIOAuth :
|
||||
R.string.gtasks_GLA_errorAuth;
|
||||
Toast.makeText(WelcomeWalkthrough.this,
|
||||
error,
|
||||
Toast.LENGTH_LONG).show();
|
||||
onAuthError();
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
if (dismissDialog) {
|
||||
DialogUtilities.dismissDialog(WelcomeWalkthrough.this, pd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
};
|
||||
accountManager.manager.getAuthToken(a, ActFmGoogleAuthActivity.AUTH_TOKEN_TYPE, null, WelcomeWalkthrough.this, callback, null);
|
||||
}
|
||||
});
|
||||
|
||||
TextView rejectQuickLogin = (TextView) findViewById(R.id.quick_login_reject);
|
||||
rejectQuickLogin.setText(getString(R.string.actfm_quick_login_reject, email));
|
||||
rejectQuickLogin.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switchToLoginPage();
|
||||
}
|
||||
});
|
||||
|
||||
errors = (TextView) findViewById(R.id.error);
|
||||
}
|
||||
|
||||
private void onAuthTokenSuccess(final String email, final String authToken) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
authenticate(email, email, "", "google", authToken); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onAuthError() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
switchToLoginPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void switchToLoginPage() {
|
||||
mAdapter.changeLoginPage(getLoginPageLayout());
|
||||
mPager.setAdapter(mAdapter);
|
||||
mPager.setCurrentItem(mAdapter.layouts.length - 1, false);
|
||||
initializeUI();
|
||||
}
|
||||
|
||||
public void onPageChanged(View view, int position) {
|
||||
int currentPage = position;
|
||||
currentView = view;
|
||||
findViewById(R.id.next).setVisibility(
|
||||
position == mAdapter.getCount() - 1 ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (currentPage == mAdapter.getCount() - 1) {
|
||||
if (findViewById(R.id.fb_login) != null) {
|
||||
setupLoginLater();
|
||||
} else {
|
||||
OnClickListener done = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
View title = currentView.findViewById(R.id.welcome_walkthrough_title);
|
||||
if (title != null) {
|
||||
title.setOnClickListener(done);
|
||||
}
|
||||
View image = currentView.findViewById(R.id.welcome_walkthrough_image);
|
||||
if (image != null) {
|
||||
image.setOnClickListener(done);
|
||||
}
|
||||
}
|
||||
}
|
||||
mIndicator.setVisibility(currentPage == mAdapter.getCount() - 1 ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
protected void setupPWLogin() {
|
||||
Button pwLogin = (Button) findViewById(R.id.pw_signup);
|
||||
pwLogin.setOnClickListener(signUpListener);
|
||||
}
|
||||
|
||||
protected void setupLoginLater() {
|
||||
TextView loginLater = (TextView) currentView.findViewById(R.id.login_later);
|
||||
loginLater.setOnClickListener(loginLaterListener);
|
||||
loginLater.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
protected final OnClickListener loginLaterListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
String title = getString(R.string.welcome_login_confirm_later_title);
|
||||
String confirmLater = getString(R.string.welcome_login_confirm_later_dialog);
|
||||
DialogUtilities.okCancelCustomDialog(WelcomeWalkthrough.this, title, confirmLater,
|
||||
R.string.welcome_login_confirm_later_ok,
|
||||
R.string.welcome_login_confirm_later_cancel,
|
||||
android.R.drawable.ic_dialog_alert,
|
||||
null, confirmLaterListener);
|
||||
}
|
||||
|
||||
private final DialogInterface.OnClickListener confirmLaterListener = new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue