Android Open Source - PrettyBundle Test Array Extras 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 .ja  v a 2s  . c o  m
import android.app.Activity;
import android.os.Bundle;
import android.os.Parcelable;
import android.widget.TextView;

import com.tale.prettybundle.Extra;
import com.tale.prettybundle.PrettyBundle;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by giang on 2/25/15.
 */
public class TestArrayExtrasActivity extends Activity {

    @Extra int[] ints;
    @Extra long[] longs;
    @Extra float[] floats;
    @Extra double[] doubles;
    @Extra boolean[] booleans;
    @Extra String[] strings;
    @Extra Parcelable[] people;

    @InjectView(R.id.tvInts) TextView tvInts;
    @InjectView(R.id.tvLongs) TextView tvLongs;
    @InjectView(R.id.tvFloats) TextView tvFloats;
    @InjectView(R.id.tvDoubles) TextView tvDoubles;
    @InjectView(R.id.tvBooleans) TextView tvBooleans;
    @InjectView(R.id.tvStrings) TextView tvStrings;
    @InjectView(R.id.tvPeople) TextView tvPeople;

    @Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_array_extras);
        ButterKnife.inject(this);
        PrettyBundle.inject(this);

        StringBuilder sb = new StringBuilder("");
        if (ints != null && ints.length > 0) {
            sb.append("{");
            for (int i = 0; i < ints.length; i++) {
                sb.append(ints[i]);
                if (i < ints.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvInts.setText(sb.toString());
        sb.setLength(0);

        if (longs != null && longs.length > 0) {
            sb.append("{");
            for (int i = 0; i < longs.length; i++) {
                sb.append(longs[i]);
                if (i < longs.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvLongs.setText(sb.toString());
        sb.setLength(0);

        if (floats != null && floats.length > 0) {
            sb.append("{");
            for (int i = 0; i < floats.length; i++) {
                sb.append(floats[i]);
                if (i < floats.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvFloats.setText(sb.toString());
        sb.setLength(0);

        if (doubles != null && doubles.length > 0) {
            sb.append("{");
            for (int i = 0; i < doubles.length; i++) {
                sb.append(doubles[i]);
                if (i < doubles.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvDoubles.setText(sb.toString());
        sb.setLength(0);

        if (booleans != null && booleans.length > 0) {
            sb.append("{");
            for (int i = 0; i < booleans.length; i++) {
                sb.append(booleans[i]);
                if (i < booleans.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvBooleans.setText(sb.toString());
        sb.setLength(0);

        if (strings != null && strings.length > 0) {
            sb.append("{");
            for (int i = 0; i < strings.length; i++) {
                sb.append(strings[i]);
                if (i < strings.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvStrings.setText(sb.toString());
        sb.setLength(0);

        if (people != null && people.length > 0) {
            sb.append("{");
            for (int i = 0; i < people.length; i++) {
                sb.append(people[i].toString());
                if (i < people.length - 1) {
                    sb.append(",");
                }
            }
            sb.append("}");
        }
        tvPeople.setText(sb.toString());
        sb.setLength(0);
    }
}




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