Android Open Source - nPuzzle Image Selection






From Project

Back to project page nPuzzle.

License

The source code is released under:

MIT License

If you think the Android project nPuzzle 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 net.cs76.projects.npuzzle;
//  w  w w.  j  av  a  2s . c  o m
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

/**
 * Activity to select a puzzle to play
 * @author Greg Chapman
 *
 */
public class ImageSelection extends ListActivity
{
   private static final String sAssetPath = "puzzles";
   private ImageListAdapter mAdapter;
   
   @Override
   protected void onCreate(Bundle savedInstanceState)
   {
      super.onCreate(savedInstanceState);
      
      mAdapter = new ImageListAdapter(this, sAssetPath);
      setListAdapter(mAdapter);
      
      PuzzleSettings lSettings = PuzzleSettings.load(this);
      if(lSettings != null)
      {
         launchPuzzle(lSettings.selection);
      }
   }
   
   private void launchPuzzle(int aPosition)
   {
      Intent lLaunchPuzzle = new Intent(this, GamePlay.class);
      lLaunchPuzzle.putExtra("selection", aPosition);
      lLaunchPuzzle.putExtra("selection.path", sAssetPath);
      startActivity(lLaunchPuzzle);
   }
   
   @Override
   protected void onListItemClick(ListView aListView, View aView, int aPosition, long aId) 
   {
      PuzzleSettings.reset(this);
      launchPuzzle(aPosition);
   }

}




Java Source Code List

net.cs76.projects.npuzzle.GamePlay.java
net.cs76.projects.npuzzle.ImageListAdapter.java
net.cs76.projects.npuzzle.ImageSelection.java
net.cs76.projects.npuzzle.ImageUtility.java
net.cs76.projects.npuzzle.PuzzleBoard.java
net.cs76.projects.npuzzle.PuzzleGridAdapter.java
net.cs76.projects.npuzzle.PuzzleSettings.java
net.cs76.projects.npuzzle.YouWin.java