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

@ -34,7 +34,7 @@
a:layout_height="0dp"
a:layout_weight="1"
a:padding="6dp"
a:gravity="center"/>
a:gravity="center" />
<LinearLayout
a:orientation="horizontal"
@ -46,14 +46,20 @@
a:layout_height="wrap_content"
a:layout_width="0dp"
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
a:id="@+id/wizard_next_button"
a:layout_height="wrap_content"
a:layout_width="0dp"
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>

View File

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

View File

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

View File

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

View File

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

View File

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