danvim / Procal

2 stars 0 forks source link

`hyp` trigonometric key #10

Closed bryanchun closed 7 years ago

bryanchun commented 7 years ago

Ideally: if(hyp is off){key sin has shift asin, key cos has shift acos, key tan has shift atan} key hyp changes these three buttons to point to another json object respectively: if(hyp is on){key sinh has shift asinh, key cosh has shift acosh, key tanh has shift atanh}

Simpler way: Make hyp shift {sinh, cosh, tanh, asinh, acosh, atanh} Issue being popupWindow may not be able to handle all these in one row.

EDIT: CalcBtn extends ViewSwitcher Create dynamically the following for each CalcBtn, this is sample structure using sin and sqroot.

Most complex case:

<ViewSwitcher>

    <LinearLayout>
        android:id = "normal"

        <mainButton
            android:id = "sin"/>

        <PopupWindow>
            <PopupView>

                <PopupButton
                 android:id = "asin"/>

                <PopupButton
                 android:id = "var_D"/>

            </PopupView>
        </PopupWindow>

    </LinearLayout>

    <LinearLayout>
        android:id = "shift"

        <mainButton
            android:id = "asin"/>

    </LinearLayout>

    <LinearLayout>
        android:id = "alpha"

        <mainButton
            android:id = "var_D"/>

    </LinearLayout>

    <LinearLayout>
        android:id = "hyp"

        <mainButton
            android:id = "sinh"/>

        <PopupWindow>
            <PopupView>

                <PopupButton
                 android:id = "asinh"/>

            </PopupView>
        </PopupWindow>

    </LinearLayout>

</ViewSwitcher>

Trivial case

<ViewSwitcher>

    <LinearLayout>
        android:id = "normal"

        <mainButton
            android:id = "sqroot"/>

    </LinearLayout>

</ViewSwitcher>

Usage

viewSwitcher =   (ViewSwitcher)findViewById(R.id.viewSwitcher1);
        myFirstView= findViewById(R.id.view1);
        mySecondView = findViewById(R.id.view2);
        button1 = (Button) findViewById(R.id.button1);

        // Switch in shift, alpha, hyp keys
        button1.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if (viewSwitcher.getCurrentView() != myFirstView){

                    viewSwitcher.showPrevious(); 
                } else if (viewSwitcher.getCurrentView() != mySecondView){

                    viewSwitcher.showNext();
                }
            }
        });
dipsywong98 commented 7 years ago

is this already done?