Android Open Source - Lolpaper Create Grid View






From Project

Back to project page Lolpaper.

License

The source code is released under:

License THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE ...

If you think the Android project Lolpaper 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

// *****************************************************************************
//***************************
/*//  w  w w.j a  v a  2 s.  c  o  m
This class starts, creates, and handles the list of animations that will be available
to the user.
*/
//***************************
// *****************************************************************************



package hyoma.app.lollivewallpaper;

import hyoma.app.lollivewallpaper.AnimationsImageAdapter;
import android.app.Activity;
import android.app.WallpaperManager;
import android.content.ComponentName;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.AdapterView.OnItemClickListener;

public class CreateGridView {
  // Main static used to reference the current xml file used to create the animation system
  public static String currentXML = "raw/animation_list_riven";
  
  final Activity mainAct;
  CreateGridView(final Activity act){
    mainAct = act;
    GridView gridView;
  
    gridView = (GridView) act.findViewById(R.id.animationview);
  
    // Provides the grids data
    gridView.setAdapter(new AnimationsImageAdapter(act));
  
    gridView.setOnItemClickListener(new OnItemClickListener() {
         public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
           if(position == 0){ onChibiMordClick(); }
           if(position == 1){ onRivenClick(); }
         }
    });
  }
  
  public void onChibiMordClick() {
    CreateGridView.currentXML = "raw/animation_list_chibimord";
    Intent mordIntent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
    mordIntent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(mainAct, LolpaperService.class));
    mainAct.startActivity(mordIntent);
  }
  public void onRivenClick() {
    CreateGridView.currentXML = "raw/animation_list_riven";
    Intent rivenIntent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
    rivenIntent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(mainAct, LolpaperService.class));
    mainAct.startActivity(rivenIntent);
  }
  
};




Java Source Code List

hyoma.app.lollivewallpaper.AnimationListXMLParser.java
hyoma.app.lollivewallpaper.AnimationSystem.java
hyoma.app.lollivewallpaper.AnimationsImageAdapter.java
hyoma.app.lollivewallpaper.CreateGridView.java
hyoma.app.lollivewallpaper.LolpaperService.java
hyoma.app.lollivewallpaper.SettingsActivity.java
hyoma.app.lollivewallpaper.SettingsFragment.java
hyoma.app.lollivewallpaper.StartLolpaperActivity.java
hyoma.app.lollivewallpaper.WallpaperChangedReciever.java