Android Open Source - no-cloud-share Intro Activity






From Project

Back to project page no-cloud-share.

License

The source code is released under:

GNU General Public License

If you think the Android project no-cloud-share 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 de.ub0r.android.nocloudshare;
/*  w  ww .  j  a  v  a  2 s.com*/
import com.viewpagerindicator.CirclePageIndicator;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * @author flx
 */
public class IntroActivity extends Activity {

    static class IntroAdapter extends PagerAdapter {

        private static final int[] IMAGES = {
                R.drawable.intro_0,
                R.drawable.intro_1,
                R.drawable.intro_2,
        };

        private static final int[] TEXTS = {
                R.string.intro_0,
                R.string.intro_1,
                R.string.intro_2,
        };

        private final Context mContext;

        private final LayoutInflater mInflater;

        public IntroAdapter(final Context context) {
            mContext = context;
            mInflater = LayoutInflater.from(context);
        }

        @Override
        public Object instantiateItem(final ViewGroup container, final int position) {
            View v = mInflater.inflate(R.layout.item_intro, container, false);
            ImageView iv = (ImageView) v.findViewById(android.R.id.icon);
            TextView tv1 = (TextView) v.findViewById(android.R.id.text1);
            TextView tv2 = (TextView) v.findViewById(android.R.id.text2);
            iv.setImageResource(IMAGES[position]);
            tv1.setText(mContext.getString(R.string.step_num, position + 1));
            tv2.setText(TEXTS[position]);
            container.addView(v);
            return v;
        }

        @Override
        public void destroyItem(final ViewGroup container, final int position,
                final Object object) {
            container.removeView((View) object);
        }

        @Override
        public int getCount() {
            return 3;
        }

        @Override
        public boolean isViewFromObject(final View view, final Object object) {
            return view == object;
        }
    }

    @InjectView(R.id.viewpager)
    ViewPager mViewPager;

    @InjectView(R.id.indicator)
    CirclePageIndicator mIndicator;

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_intro);
        ButterKnife.inject(this);
        //noinspection ConstantConditions
        getActionBar().setDisplayHomeAsUpEnabled(true);

        mViewPager.setAdapter(new IntroAdapter(this));
        mIndicator.setViewPager(mViewPager);
    }

    @Override
    public boolean onOptionsItemSelected(final MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}




Java Source Code List

de.ub0r.android.nocloudshare.AboutActivity.java
de.ub0r.android.nocloudshare.HttpService.java
de.ub0r.android.nocloudshare.IntroActivity.java
de.ub0r.android.nocloudshare.SettingsActivity.java
de.ub0r.android.nocloudshare.ShareActivity.java
de.ub0r.android.nocloudshare.ShareFragment.java
de.ub0r.android.nocloudshare.ShareListActivity.java
de.ub0r.android.nocloudshare.http.BitmapLruCache.java
de.ub0r.android.nocloudshare.http.Httpd.java
de.ub0r.android.nocloudshare.model.GsonFactory.java
de.ub0r.android.nocloudshare.model.ShareItemContainer.java
de.ub0r.android.nocloudshare.model.ShareItem.java
de.ub0r.android.nocloudshare.views.CheckableRelativeLayout.java
de.ub0r.android.nocloudshare.views.MeasuringRelativeLayout.java
fi.iki.elonen.NanoHTTPD.java