Android Open Source - Werewolf-Android-Client Main Interface






From Project

Back to project page Werewolf-Android-Client.

License

The source code is released under:

Copyright (c) 2013, Timothy Cohen All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project Werewolf-Android-Client 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 edu.wm.werewolf_client;
/*from   w  ww .j  av  a2 s . c o m*/
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Activity;
import android.app.Fragment; 
import android.app.FragmentTransaction;
import android.os.Bundle;

public class MainInterface extends Activity{
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_tabsholder);
 
      Bundle b = this.getIntent().getExtras();
    final String username = b.getString("username");
    final String password = b.getString("password");
    
    UsernameAndPassword.setUsername(username);
    UsernameAndPassword.setPassword(password);
    
      ActionBar bar = getActionBar();
      bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
      ActionBar.Tab userTab = bar.newTab().setText("Statistics");
      ActionBar.Tab dayTab = bar.newTab().setText("Day Actions");
      ActionBar.Tab nightTab = bar.newTab().setText("Night Actions");

      Fragment userFragment = new UserTab();
      Fragment dayFragment = new DayTab();
      Fragment nightFragment = new NightTab();

      userTab.setTabListener(new MyTabsListener(userFragment));
      dayTab.setTabListener(new MyTabsListener(dayFragment));
      nightTab.setTabListener(new MyTabsListener(nightFragment));

      bar.addTab(userTab);
      bar.addTab(dayTab);
      bar.addTab(nightTab);

  }

  protected class MyTabsListener implements ActionBar.TabListener {

      private Fragment fragment;

      public MyTabsListener(Fragment fragment) {
          this.fragment = fragment;
      }

      public void onTabReselected(Tab tab, FragmentTransaction ft) {
        ft.remove(fragment);
      }

      public void onTabUnselected(Tab tab, FragmentTransaction ft) {
          ft.remove(fragment);
      }

    @Override
    public void onTabSelected(Tab arg0, FragmentTransaction ft) {
      ft.add(R.id.fragment_container, fragment, null);
      
    }
  }
  


  

}




Java Source Code List

edu.wm.werewolf_client.DayTab.java
edu.wm.werewolf_client.FindLocation.java
edu.wm.werewolf_client.GetAllAlive.java
edu.wm.werewolf_client.GetKills.java
edu.wm.werewolf_client.IsNight.java
edu.wm.werewolf_client.KillAttempt.java
edu.wm.werewolf_client.Locate.java
edu.wm.werewolf_client.MainActivity.java
edu.wm.werewolf_client.MainInterface.java
edu.wm.werewolf_client.NightTab.java
edu.wm.werewolf_client.ObatainLocation.java
edu.wm.werewolf_client.Play.java
edu.wm.werewolf_client.Player.java
edu.wm.werewolf_client.Register.java
edu.wm.werewolf_client.Stats.java
edu.wm.werewolf_client.UserTab.java
edu.wm.werewolf_client.UsernameAndPassword.java
edu.wm.werewolf_client.Validate.java
edu.wm.werewolf_client.Vote.java
edu.wm.werewolf_client.isWerewolf.java