Android Open Source - PrettyBundle Test Primary Type Setter Activity






From Project

Back to project page PrettyBundle.

License

The source code is released under:

Apache License

If you think the Android project PrettyBundle listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tale.prettybundle.sample;
/*from w  w w.j a v  a2 s .c  om*/
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.CheckBox;
import android.widget.EditText;

import com.tale.prettybundle.Activities;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by giang on 2/24/15.
 */
public class TestPrimaryTypeSetterActivity extends Activity {

    @InjectView(R.id.etInt) EditText etInt;
    @InjectView(R.id.etLong) EditText etLong;
    @InjectView(R.id.etFloat) EditText etFloat;
    @InjectView(R.id.etDouble) EditText etDouble;
    @InjectView(R.id.cbBoolean) CheckBox cbBoolean;
    @InjectView(R.id.etString) EditText etString;
    @InjectView(R.id.etCharSequence) EditText etCharSequence;

    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_primary_type_setter);
        ButterKnife.inject(this);
        ButterKnife.inject(this);
    }

    @OnClick(R.id.btSubmit) public void submit() {

        int intVal;
        if (TextUtils.isEmpty(etInt.getText().toString())) {
            intVal = 0;
        } else {
            intVal = Integer.parseInt(etInt.getText().toString());
        }

        long longVal;
        if (TextUtils.isEmpty(etLong.getText().toString())) {
            longVal = 0;
        } else {
            longVal = Long.parseLong(etLong.getText().toString());
        }

        float floatVal;
        if (TextUtils.isEmpty(etFloat.getText().toString())) {
            floatVal = 0;
        } else {
            floatVal = Float.parseFloat(etFloat.getText().toString());
        }

        double doubleVal;
        if (TextUtils.isEmpty(etDouble.getText().toString())) {
            doubleVal = 0;
        } else {
            doubleVal = Double.parseDouble(etDouble.getText().toString());
        }

        String stringVal;
        if (TextUtils.isEmpty(etString.getText().toString())) {
            stringVal = null;
        } else {
            stringVal = etString.getText().toString();
        }

        CharSequence charSequenceVal;
        if (TextUtils.isEmpty(etCharSequence.getText())) {
            charSequenceVal = null;
        } else {
            charSequenceVal = etCharSequence.getText();
        }

        boolean booleanVal = cbBoolean.isChecked();

        startActivity(Activities.createTestPrimaryTypeDisplayActivityIntent(this, intVal, longVal, floatVal, doubleVal, booleanVal, stringVal, charSequenceVal));

    }
}




Java Source Code List

com.tale.prettybundle.ExtraBinderProvider.java
com.tale.prettybundle.ExtraBinder.java
com.tale.prettybundle.Extra.java
com.tale.prettybundle.Injector.java
com.tale.prettybundle.PrettyBundle.java
com.tale.prettybundle.internal.ExtraAnnotatedClass.java
com.tale.prettybundle.internal.ExtraClassesGrouped.java
com.tale.prettybundle.internal.ExtraInjectorClassBuilder.java
com.tale.prettybundle.internal.ExtraUtilityClassBuilder.java
com.tale.prettybundle.internal.PrettyBundleProcessor.java
com.tale.prettybundle.internal.SupportedType.java
com.tale.prettybundle.sample.ActivitiesClassTest.java
com.tale.prettybundle.sample.ActivitiesTest.java
com.tale.prettybundle.sample.ApplicationTest.java
com.tale.prettybundle.sample.BaseActivityUnitTestCase.java
com.tale.prettybundle.sample.InjectArrayExtrasTest.java
com.tale.prettybundle.sample.InjectParcelableExtrasTest.java
com.tale.prettybundle.sample.InjectPrimaryTypeExtrasFragmentTest.java
com.tale.prettybundle.sample.InjectPrimaryTypeExtrasTest.java
com.tale.prettybundle.sample.InjectStringExtrasTest.java
com.tale.prettybundle.sample.MainActivity.java
com.tale.prettybundle.sample.MenuActivity.java
com.tale.prettybundle.sample.TestArrayExtrasActivity.java
com.tale.prettybundle.sample.TestExtraOnFragmentActivity.java
com.tale.prettybundle.sample.TestParcelableActivity.java
com.tale.prettybundle.sample.TestPrimaryTypeDisplayActivity.java
com.tale.prettybundle.sample.TestPrimaryTypeSetterActivity.java
com.tale.prettybundle.sample.TestStringExtra1Activity.java
com.tale.prettybundle.sample.TestStringExtra2Activity.java
com.tale.prettybundle.sample.data.Person.java
com.tale.prettybundle.sample.espresso.ExtViewActions.java
com.tale.prettybundle.sample.fragments.TestPrimaryExtraFragment.java
com.tale.prettybundle.sample.services.TestPrimaryTypeService.java