wizard fixes

This commit is contained in:
Sergey Solovyev 2013-07-18 11:38:33 +04:00
parent 53e23570a0
commit 525165a0c8
6 changed files with 58 additions and 43 deletions

View File

@ -23,37 +23,43 @@
--> -->
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/wizard_layout" a:id="@+id/wizard_layout"
style="?cpp_dialog_style" style="?cpp_dialog_style"
a:orientation="vertical"> a:orientation="vertical">
<FrameLayout <FrameLayout
a:orientation="vertical" a:orientation="vertical"
a:id="@+id/wizard_content" a:id="@+id/wizard_content"
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="0dp" a:layout_height="0dp"
a:layout_weight="1" a:layout_weight="1"
a:padding="6dp" a:padding="6dp"
a:gravity="center"/> a:gravity="center" />
<LinearLayout <LinearLayout
a:orientation="horizontal" a:orientation="horizontal"
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="wrap_content"> a:layout_height="wrap_content">
<Button <Button
a:id="@+id/wizard_prev_button" a:id="@+id/wizard_prev_button"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:layout_width="0dp" a:layout_width="0dp"
a:layout_weight="1" a:layout_weight="1"
a:text="@string/cpp_wizard_back"/> a:singleLine="true"
a:lines="1"
a:maxLines="1"
a:text="@string/cpp_wizard_back" />
<Button <Button
a:id="@+id/wizard_next_button" a:id="@+id/wizard_next_button"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:layout_width="0dp" a:layout_width="0dp"
a:layout_weight="1" a:layout_weight="1"
a:text="@string/cpp_wizard_next"/> a:singleLine="true"
a:lines="1"
a:maxLines="1"
a:text="@string/cpp_wizard_next" />
</LinearLayout> </LinearLayout>

View File

@ -29,6 +29,7 @@
a:orientation="vertical"> a:orientation="vertical">
<TextView <TextView
a:id="@+id/wizard_dragbutton_description_textview"
a:text="@string/cpp_wizard_dragbutton_description" a:text="@string/cpp_wizard_dragbutton_description"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:layout_width="match_parent"/> a:layout_width="match_parent"/>
@ -42,7 +43,7 @@
a:layout_width="match_parent"/> a:layout_width="match_parent"/>
<org.solovyev.android.view.drag.DirectionDragButton <org.solovyev.android.view.drag.DirectionDragButton
a:layout_margin="30dp" a:layout_margin="10dp"
a:layout_height="100dp" a:layout_height="100dp"
a:layout_width="100dp" a:layout_width="100dp"
a:minWidth="100dp" a:minWidth="100dp"

View File

@ -32,4 +32,8 @@
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/> <org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
<Preference
a:key="restart_wizard"
a:title="@string/cpp_restart_wizard"/>
</PreferenceScreen> </PreferenceScreen>

View File

@ -45,10 +45,6 @@
a:summary="@string/c_clear_billing_info_summary" a:summary="@string/c_clear_billing_info_summary"
a:title="@string/c_clear_billing_info_title"/> a:title="@string/c_clear_billing_info_title"/>
<Preference
a:key="restart_wizard"
a:title="@string/cpp_restart_wizard"/>
</PreferenceScreen> </PreferenceScreen>
</PreferenceScreen> </PreferenceScreen>

View File

@ -31,29 +31,27 @@ import android.preference.Preference;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.SherlockPreferenceActivity; import com.actionbarsherlock.app.SherlockPreferenceActivity;
import net.robotmedia.billing.BillingController; import net.robotmedia.billing.BillingController;
import net.robotmedia.billing.IBillingObserver; import net.robotmedia.billing.IBillingObserver;
import net.robotmedia.billing.ResponseCode; import net.robotmedia.billing.ResponseCode;
import net.robotmedia.billing.helper.AbstractBillingObserver; import net.robotmedia.billing.helper.AbstractBillingObserver;
import net.robotmedia.billing.model.Transaction; import net.robotmedia.billing.model.Transaction;
import javax.annotation.Nonnull;
import org.solovyev.android.Activities; import org.solovyev.android.Activities;
import org.solovyev.android.App; import org.solovyev.android.App;
import org.solovyev.android.ads.AdsController; import org.solovyev.android.ads.AdsController;
import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine; import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
import org.solovyev.android.calculator.wizard.CalculatorWizardActivity;
import org.solovyev.android.calculator.wizard.Wizards;
import org.solovyev.android.msg.AndroidMessage; import org.solovyev.android.msg.AndroidMessage;
import org.solovyev.android.view.VibratorContainer; import org.solovyev.android.view.VibratorContainer;
import org.solovyev.common.msg.Message; import org.solovyev.common.msg.Message;
import org.solovyev.common.msg.MessageType; import org.solovyev.common.msg.MessageType;
import javax.annotation.Nonnull;
import static org.solovyev.android.calculator.wizard.CalculatorWizardActivity.startWizard;
import static org.solovyev.android.calculator.wizard.Wizards.DEFAULT_WIZARD_FLOW;
/** /**
* User: serso * User: serso
* Date: 7/16/11 * Date: 7/16/11
@ -81,7 +79,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
restartWizardPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { restartWizardPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
CalculatorWizardActivity.startWizard(Wizards.DEFAULT_WIZARD_FLOW, CalculatorPreferencesActivity.this); startWizard(DEFAULT_WIZARD_FLOW, CalculatorPreferencesActivity.this);
return true; return true;
} }
}); });

View File

@ -29,7 +29,6 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.android.view.drag.DirectionDragButton; import org.solovyev.android.view.drag.DirectionDragButton;
import org.solovyev.android.view.drag.DragButton; import org.solovyev.android.view.drag.DragButton;
@ -39,9 +38,10 @@ import org.solovyev.common.math.Point2d;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays; import java.util.Arrays;
import static android.view.View.GONE;
public class DragButtonWizardStep extends Fragment { public class DragButtonWizardStep extends Fragment {
/* /*
@ -68,15 +68,14 @@ public class DragButtonWizardStep extends Fragment {
@Nullable @Nullable
private TextView actionTextView; private TextView actionTextView;
@Nonnull
private TextView descriptionTextView;
private DragButtonAction action = DragButtonAction.center; private DragButtonAction action = DragButtonAction.center;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
action = (DragButtonAction) savedInstanceState.getSerializable(ACTION);
}
} }
@Override @Override
@ -92,8 +91,11 @@ public class DragButtonWizardStep extends Fragment {
dragButton.setOnClickListener(new DragButtonOnClickListener()); dragButton.setOnClickListener(new DragButtonOnClickListener());
dragButton.setOnDragListener(new SimpleOnDragListener(new DragButtonProcessor(), SimpleOnDragListener.getDefaultPreferences(getActivity()))); dragButton.setOnDragListener(new SimpleOnDragListener(new DragButtonProcessor(), SimpleOnDragListener.getDefaultPreferences(getActivity())));
actionTextView = (TextView) root.findViewById(R.id.wizard_dragbutton_action_textview); actionTextView = (TextView) root.findViewById(R.id.wizard_dragbutton_action_textview);
descriptionTextView = (TextView) root.findViewById(R.id.wizard_dragbutton_description_textview);
actionTextView.setText(action.actionTextResId); if (savedInstanceState != null) {
setAction((DragButtonAction) savedInstanceState.getSerializable(ACTION));
}
} }
@Override @Override
@ -173,6 +175,14 @@ public class DragButtonWizardStep extends Fragment {
if (actionTextView != null) { if (actionTextView != null) {
actionTextView.setText(this.action.actionTextResId); actionTextView.setText(this.action.actionTextResId);
} }
boolean firstChange = false;
if (action != DragButtonAction.center) {
firstChange = true;
}
if (firstChange) {
descriptionTextView.setVisibility(GONE);
}
} }
} }
} }