Android Open Source - AndroidSettlers Reference






From Project

Back to project page AndroidSettlers.

License

The source code is released under:

GNU General Public License

If you think the Android project AndroidSettlers 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.settlers.hd;
/*from   w  w w  .ja  v a2 s. c om*/
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.View;
import android.view.ViewGroup;

public class Reference extends Activity {

  private static final int[] LAYOUTS = { R.layout.reference_build, R.layout.reference_buy,
      R.layout.reference_development };

  private static final int[] NAMES = { R.string.reference_tab1, R.string.reference_tab2, R.string.reference_tab3 };

  private View[] views;

  @Override
  public void onCreate(Bundle state) {
    super.onCreate(state);

    setContentView(R.layout.reference);
    setTitle(getString(R.string.reference));

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    views = new View[LAYOUTS.length];
    
    for (int i = 0; i < LAYOUTS.length; i++)
      views[i] = inflater.inflate(LAYOUTS[i], null);
    
    ViewPager viewPager = (ViewPager) findViewById(R.id.reference);
    viewPager.setAdapter(new ReferenceTabAdapter());
    viewPager.setCurrentItem(1);
  }

  public class ReferenceTabAdapter extends PagerAdapter {

    @Override
    public int getCount() {
      return views.length;
    }

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

    @Override
    public Object instantiateItem(ViewGroup collection, int position) {
      collection.addView(views[position]);
      return views[position];
    }

    @Override
    public void destroyItem(ViewGroup collection, int position, Object view) {
      collection.removeView((View) view);
    }

    @Override
    public CharSequence getPageTitle(int position) {
      return getString(NAMES[position]);
    }
  }
}




Java Source Code List

com.settlers.hd.AcceptTrade.java
com.settlers.hd.AutomatedPlayer.java
com.settlers.hd.BalancedAI.java
com.settlers.hd.Board.java
com.settlers.hd.CounterOffer.java
com.settlers.hd.Discard.java
com.settlers.hd.Edge.java
com.settlers.hd.GameActivity.java
com.settlers.hd.GameRenderer.java
com.settlers.hd.GameView.java
com.settlers.hd.Geometry.java
com.settlers.hd.Hexagon.java
com.settlers.hd.LocalGame.java
com.settlers.hd.Main.java
com.settlers.hd.PlayerTrade.java
com.settlers.hd.Player.java
com.settlers.hd.Reference.java
com.settlers.hd.ResourceView.java
com.settlers.hd.Rules.java
com.settlers.hd.Settings.java
com.settlers.hd.Settlers.java
com.settlers.hd.Square.java
com.settlers.hd.Stats.java
com.settlers.hd.Status.java
com.settlers.hd.TextureManager.java
com.settlers.hd.Trader.java
com.settlers.hd.UIButton.java
com.settlers.hd.Vertex.java