Remove help info popovers
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
@ -1,41 +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.
|
|
||||||
-->
|
|
||||||
<RelativeLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/gdi_message"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/gdi_arrow_up"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:background="@drawable/popover_bg"
|
|
||||||
android:fadingEdgeLength="0dp"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/gdi_arrow_up"
|
|
||||||
android:layout_marginBottom="-18dip"
|
|
||||||
android:layout_width="27dip"
|
|
||||||
android:layout_height="27dip"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/popover_arrow_up" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/gdi_arrow_down"
|
|
||||||
android:layout_width="27dip"
|
|
||||||
android:layout_height="27dip"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:layout_below="@id/gdi_message"
|
|
||||||
android:layout_marginTop="-19dip"
|
|
||||||
android:src="@drawable/popover_arrow_down" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
@ -1,41 +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.
|
|
||||||
-->
|
|
||||||
<RelativeLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/gdi_message"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/gdi_arrow_up"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:background="@drawable/popover_bg"
|
|
||||||
android:fadingEdgeLength="0dp"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/gdi_arrow_up"
|
|
||||||
android:layout_marginBottom="-15dip"
|
|
||||||
android:layout_width="27dip"
|
|
||||||
android:layout_height="27dip"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/popover_arrow_up" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/gdi_arrow_down"
|
|
||||||
android:layout_width="27dip"
|
|
||||||
android:layout_height="27dip"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:layout_below="@id/gdi_message"
|
|
||||||
android:layout_marginTop="-16dip"
|
|
||||||
android:src="@drawable/popover_arrow_down" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
@ -1,108 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2012 Todoroo Inc
|
|
||||||
*
|
|
||||||
* See the file "LICENSE" for the full license governing this code.
|
|
||||||
*/
|
|
||||||
package com.todoroo.astrid.welcome;
|
|
||||||
|
|
||||||
import greendroid.widget.QuickAction;
|
|
||||||
import greendroid.widget.QuickActionWidget;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.timsu.astrid.R;
|
|
||||||
import com.todoroo.astrid.utility.AstridPreferences;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a popover with some help text for first time users.
|
|
||||||
*
|
|
||||||
* @author Sam Bosley <sam@astrid.com>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class HelpInfoPopover extends QuickActionWidget {
|
|
||||||
|
|
||||||
public static HelpInfoPopover showPopover(final Activity activity, final View parent,
|
|
||||||
final int textId, OnDismissListener dismissListener) {
|
|
||||||
final HelpInfoPopover toShow = new HelpInfoPopover(activity, textId);
|
|
||||||
if (dismissListener != null) {
|
|
||||||
toShow.setOnDismissListener(dismissListener);
|
|
||||||
}
|
|
||||||
parent.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
toShow.show(parent);
|
|
||||||
} catch (Exception e) {
|
|
||||||
//Activity wasn't running or something like that
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 250);
|
|
||||||
return toShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final boolean tablet;
|
|
||||||
private int measuredWidth;
|
|
||||||
|
|
||||||
private HelpInfoPopover(Context context, int textId) {
|
|
||||||
super(context);
|
|
||||||
setContentView(R.layout.help_popover);
|
|
||||||
TextView message = (TextView)getContentView().findViewById(R.id.gdi_message);
|
|
||||||
message.setText(textId);
|
|
||||||
setFocusable(false);
|
|
||||||
setTouchable(true);
|
|
||||||
measuredWidth = -1; // uninitialized
|
|
||||||
tablet = AstridPreferences.useTabletLayout(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateQuickActions(List<QuickAction> quickActions) {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getArrowLeftMargin(View arrow) {
|
|
||||||
if (measuredWidth > 0) {
|
|
||||||
return (measuredWidth - arrow.getMeasuredWidth()) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tablet) {
|
|
||||||
return mRect.width() / 4;
|
|
||||||
}
|
|
||||||
return mRect.width() / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getShowAtX() {
|
|
||||||
if (measuredWidth > 0) {
|
|
||||||
return mRect.left + (mRect.width() - measuredWidth) / 2;
|
|
||||||
}
|
|
||||||
return mRect.left;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onMeasureAndLayout(Rect anchorRect, View contentView) {
|
|
||||||
contentView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
||||||
contentView.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
|
|
||||||
int rootHeight = contentView.getMeasuredHeight();
|
|
||||||
measuredWidth = contentView.getMeasuredWidth();
|
|
||||||
|
|
||||||
int offsetY = getArrowOffsetY();
|
|
||||||
int dyTop = anchorRect.top;
|
|
||||||
int dyBottom = getScreenHeight() - anchorRect.bottom;
|
|
||||||
|
|
||||||
boolean onTop = (dyTop > dyBottom);
|
|
||||||
int popupY = (onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY;
|
|
||||||
|
|
||||||
setWidgetSpecs(popupY, onTop);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|