Commits

Anonymous committed d5a818d

changed braces and eclipse formatting

Comments (0)

Files changed (52)

.settings/org.eclipse.jdt.core.prefs

 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=48
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=48
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
 org.eclipse.jdt.core.formatter.blank_lines_before_package=0
 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
 org.eclipse.jdt.core.formatter.comment.format_block_comments=true
 org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
 org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
 org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=150
+org.eclipse.jdt.core.formatter.lineSplit=120
 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
 org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0

.settings/org.eclipse.jdt.ui.prefs

 cleanup_profile=_sai_clean_prefs
 cleanup_settings_version=2
 eclipse.preferences.version=1
-formatter_profile=_sai_prefs
+formatter_profile=_edited_for_line_length
 formatter_settings_version=12

src/com/w4rlock/backpapermusic/AbsActivity.java

 import com.w4rlock.backpapermusic.util.L;
 import com.w4rlock.backpapermusic.util.Utils;
 
-public class AbsActivity extends ActionBarActivity implements LoadingInterface
-{
+public class AbsActivity extends ActionBarActivity implements LoadingInterface {
 
 	private View mSyncProgressBar;
 
 	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
+	protected void onCreate(Bundle savedInstanceState) {
 		requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
 		super.onCreate(savedInstanceState);
 	}
 
 	@SuppressLint("InlinedApi")
-	private void ensureProgressBars()
-	{
-		if (Utils.isOverHoneyComb() && mSyncProgressBar == null)
-		{
+	private void ensureProgressBars() {
+		if (Utils.isOverHoneyComb() && mSyncProgressBar == null) {
 			int actionBarHeight;
-			final TypedArray styledAttributes = getApplicationContext().getTheme().obtainStyledAttributes(new int[]
-			{ android.R.attr.actionBarSize });
+			final TypedArray styledAttributes = getApplicationContext().getTheme().obtainStyledAttributes(
+					new int[] { android.R.attr.actionBarSize });
 			actionBarHeight = (int) styledAttributes.getDimension(0, 0);
 			styledAttributes.recycle();
 
 			mSyncProgressBar = v.findViewById(R.id.progress);
 			L.d("progressbar", "" + actionBarHeight);
 			mSyncProgressBar.setMinimumHeight(actionBarHeight);
-			if (getActionBarView() != null)
-			{
+			if (getActionBarView() != null) {
 				((ViewGroup) getActionBarView()).addView(v);
-			} else
-			{
+			} else {
 				L.d("progressbar", "Null on getting action bar view");
 			}
 		}
-		if (Utils.isOverHoneyComb())
-		{
+		if (Utils.isOverHoneyComb()) {
 			setSupportProgressBarIndeterminateVisibility(false);
 		}
 	}
 
-	protected void showSyncStatusBar()
-	{
-		if (Utils.isOverHoneyComb())
-		{
+	protected void showSyncStatusBar() {
+		if (Utils.isOverHoneyComb()) {
 			L.d("progressbar", "show sync status bar");
 			ensureProgressBars();
 			mSyncProgressBar.setVisibility(View.VISIBLE);
-		} else
-		{
+		} else {
 			setSupportProgressBarIndeterminateVisibility(true);
 		}
 	}
 
-	protected void hideSyncStatusBar()
-	{
-		if (Utils.isOverHoneyComb())
-		{
+	protected void hideSyncStatusBar() {
+		if (Utils.isOverHoneyComb()) {
 			L.d("progressbar", "show sync status bar");
 			ensureProgressBars();
 			mSyncProgressBar.setVisibility(View.GONE);
-		} else
-		{
+		} else {
 			setSupportProgressBarIndeterminateVisibility(false);
 		}
 	}
 
-	public View getActionBarView()
-	{
+	public View getActionBarView() {
 		Window window = getWindow();
 		View v = window.getDecorView();
 		int resId = getResources().getIdentifier("action_bar_container", "id", "android");
 	}
 
 	@Override
-	public void onLoadingStarted()
-	{
+	public void onLoadingStarted() {
 		showSyncStatusBar();
 	}
 
 	@Override
-	public void onLoadingEnded()
-	{
+	public void onLoadingEnded() {
 		hideSyncStatusBar();
 	}
 
 	@Override
-	public void onProgressUpdate(int percent)
-	{
+	public void onProgressUpdate(int percent) {
 
 	}
 }

src/com/w4rlock/backpapermusic/MusicActivity.java

 import com.w4rlock.backpapermusic.loaders.LoadingInterface;
 import com.w4rlock.backpapermusic.util.L;
 
-public class MusicActivity extends AbsActivity
-{
+public class MusicActivity extends AbsActivity {
 	MusicListFragment musicListFragment;
+
 	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		L.d("MusicActivity","oncreate");
+	protected void onCreate(Bundle savedInstanceState) {
+		L.d("MusicActivity", "oncreate");
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_music);
-		musicListFragment = new MusicListFragment(); 
-		if (savedInstanceState == null)
-		{
-			getSupportFragmentManager().beginTransaction().add(R.id.container,musicListFragment).commit();
+		musicListFragment = new MusicListFragment();
+		if (savedInstanceState == null) {
+			getSupportFragmentManager().beginTransaction().add(R.id.container, musicListFragment).commit();
 		}
 		com.nostra13.universalimageloader.utils.L.disableLogging();
 
 		L.d("MusicActivity", "Calling Service");
-		MusicDatabaseSyncerService musicDatabaseSyncerService = new MusicDatabaseSyncerService(getApplicationContext(), loadingInterface);
+		MusicDatabaseSyncerService musicDatabaseSyncerService = new MusicDatabaseSyncerService(getApplicationContext(),
+				loadingInterface);
 		musicDatabaseSyncerService.execute();
 	}
-	
+
 	@Override
-	public void onPause(){
-		L.d("MusicActivity","onPause");
+	public void onPause() {
+		L.d("MusicActivity", "onPause");
 		super.onPause();
 	}
-	
+
 	@Override
-	public void onResume(){
-		L.d("MusicActivity","onResume");
+	public void onResume() {
+		L.d("MusicActivity", "onResume");
 		super.onResume();
 	}
 
 	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
+	public boolean onCreateOptionsMenu(Menu menu) {
 		return true;
 	}
 
 	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
+	public boolean onOptionsItemSelected(MenuItem item) {
 		int id = item.getItemId();
-		if (id == R.id.action_settings)
-		{
+		if (id == R.id.action_settings) {
 			return true;
 		}
 		return super.onOptionsItemSelected(item);
 	}
-	
-	final LoadingInterface loadingInterface = new LoadingInterface()
-	{
-		
+
+	final LoadingInterface loadingInterface = new LoadingInterface() {
+
 		@Override
-		public void onProgressUpdate(int percent)
-		{
-			
+		public void onProgressUpdate(int percent) {
+
 		}
-		
+
 		@Override
-		public void onLoadingStarted()
-		{
+		public void onLoadingStarted() {
 			showSyncStatusBar();
 		}
-		
+
 		@Override
-		public void onLoadingEnded()
-		{
+		public void onLoadingEnded() {
 			hideSyncStatusBar();
 			musicListFragment.forceLoadDataFromLoader();
 		}

src/com/w4rlock/backpapermusic/MusicPlayListActivity.java

 
 import com.w4rlock.backpapermusic.fragments.MusicPlayListFragment;
 
-public class MusicPlayListActivity extends ActionBarActivity
-{
+public class MusicPlayListActivity extends ActionBarActivity {
 
 	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
+	protected void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_music_play_list);
 		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-		if (savedInstanceState == null)
-		{
+		if (savedInstanceState == null) {
 			getSupportFragmentManager().beginTransaction().add(R.id.container, new MusicPlayListFragment()).commit();
 		}
 
 	}
 
 	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
+	public boolean onCreateOptionsMenu(Menu menu) {
 		return true;
 	}
 
 	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
+	public boolean onOptionsItemSelected(MenuItem item) {
 		int id = item.getItemId();
-		if (id == android.R.id.home)
-		{
+		if (id == android.R.id.home) {
 			Intent i = new Intent(this, MusicActivity.class);
 			i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 			startActivity(i);
 			finish();
 			return true;
 		}
-		if (id == R.id.action_settings)
-		{
+		if (id == R.id.action_settings) {
 			return true;
 		}
 		return super.onOptionsItemSelected(item);

src/com/w4rlock/backpapermusic/MusicPlayerActivity.java

 
 import com.w4rlock.backpapermusic.fragments.MusicPlayerFragment;
 
-public class MusicPlayerActivity extends ActionBarActivity
-{
+public class MusicPlayerActivity extends ActionBarActivity {
 
 	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
+	protected void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_music_player);
 		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-		if (savedInstanceState == null)
-		{
+		if (savedInstanceState == null) {
 			getSupportFragmentManager().beginTransaction().add(R.id.container, new MusicPlayerFragment()).commit();
 		}
 	}
 
 	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
+	public boolean onCreateOptionsMenu(Menu menu) {
 		getMenuInflater().inflate(R.menu.music_player, menu);
 		return true;
 	}
 
 	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
+	public boolean onOptionsItemSelected(MenuItem item) {
 		int id = item.getItemId();
-		if (id == android.R.id.home)
-		{
+		if (id == android.R.id.home) {
 			Intent i = new Intent(this, MusicActivity.class);
 			i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 			startActivity(i);
 			return true;
 		}
-		if (id == R.id.action_settings)
-		{
+		if (id == R.id.action_settings) {
 			return true;
 		}
 		return super.onOptionsItemSelected(item);

src/com/w4rlock/backpapermusic/adapters/MusicGridViewAdapter.java

 import com.w4rlock.backpapermusic.models.Song;
 import com.w4rlock.backpapermusic.util.Utils;
 
-public class MusicGridViewAdapter extends ArrayAdapter<Song>
-{
+public class MusicGridViewAdapter extends ArrayAdapter<Song> {
 	List<Song> music;
 	ImageLoader imageLoader;
 	DisplayImageOptions doptions = Utils.getDisplayImageOptions();
 	private LayoutInflater inflater;
 	static int resourceId = R.layout.grid_view_each_album;
 
-	public MusicGridViewAdapter(Context context, List<Song> music)
-	{
+	public MusicGridViewAdapter(Context context, List<Song> music) {
 		super(context, resourceId, music);
 		this.music = music;
 		imageLoader = ImageLoader.getInstance();
 	}
 
 	@Override
-	public View getView(int position, View convertView, ViewGroup parent)
-	{
+	public View getView(int position, View convertView, ViewGroup parent) {
 		View row = convertView;
 		AlbumViewHolder albumViewHolder;
-		if (row == null)
-		{
+		if (row == null) {
 			row = inflater.inflate(resourceId, parent, false);
 			albumViewHolder = new AlbumViewHolder();
 			albumViewHolder.songIcon = (ImageView) row.findViewById(R.id.album_icon);
 			albumViewHolder.songLabel = (TextView) row.findViewById(R.id.album_label);
 			row.setTag(albumViewHolder);
-		} else
-		{
+		} else {
 			albumViewHolder = (AlbumViewHolder) row.getTag();
 		}
 		Song m = this.music.get(position);
 		return row;
 	}
 
-	static class AlbumViewHolder
-	{
+	static class AlbumViewHolder {
 		public ImageView songIcon;
 		public TextView songLabel;
 	}

src/com/w4rlock/backpapermusic/adapters/MusicListDisplayAdapter.java

 import com.w4rlock.backpapermusic.R;
 import com.w4rlock.backpapermusic.models.Song;
 
-public class MusicListDisplayAdapter extends BaseExpandableListAdapter
-{
+public class MusicListDisplayAdapter extends BaseExpandableListAdapter {
 	ImageLoader imageLoader;
 	public DisplayImageOptions doptions;
 	private LayoutInflater inflater;
 	private ArrayList<Song> music;
 	private Context context;
-	public MusicListDisplayAdapter(Context context, ArrayList<Song> music)
-	{
+
+	public MusicListDisplayAdapter(Context context, ArrayList<Song> music) {
 		this.music = music;
 		this.context = context;
 		imageLoader = ImageLoader.getInstance();
 		inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 	}
 
-	static class AlbumViewHolder
-	{
+	static class AlbumViewHolder {
 		public ImageView songIcon;
 		public TextView songLabel;
 	}
-	
-	static class SongViewHolder
-	{
+
+	static class SongViewHolder {
 		public TextView songLabel;
 	}
-	
+
 	@Override
-	public Object getChild(int groupPosition, int childPosition)
-	{
-//		return this.music.get(groupPosition).getFiles().getMp3().get(childPosition);
+	public Object getChild(int groupPosition, int childPosition) {
+		// return
+		// this.music.get(groupPosition).getFiles().getMp3().get(childPosition);
 		return null;
 	}
 
 	@Override
-	public long getChildId(int groupPosition, int childPosition)
-	{
+	public long getChildId(int groupPosition, int childPosition) {
 		return childPosition;
 	}
 
 	@Override
-	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
-	{
-//		final MP3 mp3 = (MP3)getChild(groupPosition, childPosition);
-//		TextView textView;
-//		if(convertView == null){
-//			textView = new TextView(context);
-//		}else{
-//			textView = (TextView)convertView;
-//		}
-//		textView.setText(mp3.getName());
-//		return textView;
+	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
+			ViewGroup parent) {
+		// final MP3 mp3 = (MP3)getChild(groupPosition, childPosition);
+		// TextView textView;
+		// if(convertView == null){
+		// textView = new TextView(context);
+		// }else{
+		// textView = (TextView)convertView;
+		// }
+		// textView.setText(mp3.getName());
+		// return textView;
 		View row = convertView;
 		SongViewHolder songViewHolder;
-		if (row == null)
-		{
+		if (row == null) {
 			row = inflater.inflate(R.layout.each_song, parent, false);
 			songViewHolder = new SongViewHolder();
 			songViewHolder.songLabel = (TextView) row.findViewById(R.id.song_label);
 			row.setTag(songViewHolder);
-		} else
-		{
+		} else {
 			songViewHolder = (SongViewHolder) row.getTag();
 		}
 		Song m = this.music.get(groupPosition);
 	}
 
 	@Override
-	public int getChildrenCount(int groupPosition)
-	{
-//		return this.music.get(groupPosition).getFiles().getMp3().size();
+	public int getChildrenCount(int groupPosition) {
+		// return this.music.get(groupPosition).getFiles().getMp3().size();
 		return 0;
 	}
 
 	@Override
-	public Object getGroup(int groupPosition)
-	{
+	public Object getGroup(int groupPosition) {
 		return this.music.get(groupPosition);
 	}
 
 	@Override
-	public int getGroupCount()
-	{
+	public int getGroupCount() {
 		return this.music.size();
 	}
 
 	@Override
-	public long getGroupId(int groupPosition)
-	{
+	public long getGroupId(int groupPosition) {
 		return groupPosition;
 	}
 
 	@Override
-	public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
-	{
+	public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
 		View row = convertView;
 		AlbumViewHolder albumViewHolder;
-		if (row == null)
-		{
+		if (row == null) {
 			row = inflater.inflate(R.layout.each_album, parent, false);
 			albumViewHolder = new AlbumViewHolder();
 			albumViewHolder.songIcon = (ImageView) row.findViewById(R.id.album_icon);
 			albumViewHolder.songLabel = (TextView) row.findViewById(R.id.album_label);
 			row.setTag(albumViewHolder);
-		} else
-		{
+		} else {
 			albumViewHolder = (AlbumViewHolder) row.getTag();
 		}
 		Song m = this.music.get(groupPosition);
 		albumViewHolder.songLabel.setText(m.getDirname());
-		imageLoader.displayImage(m.getBaseUrl()+m.getThumbnail(),albumViewHolder.songIcon, doptions);
+		imageLoader.displayImage(m.getBaseUrl() + m.getThumbnail(), albumViewHolder.songIcon, doptions);
 		return row;
 	}
 
 	@Override
-	public boolean hasStableIds()
-	{
+	public boolean hasStableIds() {
 		return false;
 	}
 
 	@Override
-	public boolean isChildSelectable(int arg0, int arg1)
-	{
+	public boolean isChildSelectable(int arg0, int arg1) {
 		return true;
 	}
 

src/com/w4rlock/backpapermusic/adapters/MusicListViewAdapter.java

 import com.w4rlock.backpapermusic.models.Song;
 import com.w4rlock.backpapermusic.util.Utils;
 
-public class MusicListViewAdapter extends ArrayAdapter<Song>
-{
+public class MusicListViewAdapter extends ArrayAdapter<Song> {
 	List<Song> music;
 	ImageLoader imageLoader;
 	DisplayImageOptions doptions = Utils.getDisplayImageOptions();
 	private LayoutInflater inflater;
 	static int resourceId = R.layout.each_album;
 
-	public MusicListViewAdapter(Context context, List<Song> music)
-	{
+	public MusicListViewAdapter(Context context, List<Song> music) {
 		super(context, resourceId, music);
 		this.music = music;
 		imageLoader = ImageLoader.getInstance();
 	}
 
 	@Override
-	public View getView(int position, View convertView, ViewGroup parent)
-	{
+	public View getView(int position, View convertView, ViewGroup parent) {
 		View row = convertView;
 		AlbumViewHolder albumViewHolder;
-		if (row == null)
-		{
+		if (row == null) {
 			row = inflater.inflate(R.layout.each_album, parent, false);
 			albumViewHolder = new AlbumViewHolder();
 			albumViewHolder.songIcon = (ImageView) row.findViewById(R.id.album_icon);
 			albumViewHolder.songLabel = (TextView) row.findViewById(R.id.album_label);
 			row.setTag(albumViewHolder);
-		} else
-		{
+		} else {
 			albumViewHolder = (AlbumViewHolder) row.getTag();
 		}
 		Song m = this.music.get(position);
 		return row;
 	}
 
-	static class AlbumViewHolder
-	{
+	static class AlbumViewHolder {
 		public ImageView songIcon;
 		public TextView songLabel;
 	}

src/com/w4rlock/backpapermusic/adapters/PlayListDisplayAdapter.java

 import com.w4rlock.backpapermusic.models.SongItem;
 import com.w4rlock.backpapermusic.util.Utils;
 
-public class PlayListDisplayAdapter extends ArrayAdapter<SongItem>
-{
+public class PlayListDisplayAdapter extends ArrayAdapter<SongItem> {
 	private LayoutInflater inflater;
 	ImageLoader imageLoader;
 	DisplayImageOptions doptions = Utils.getDisplayImageOptions();
 
-	public PlayListDisplayAdapter(Context context, ArrayList<SongItem> songItems)
-	{
+	public PlayListDisplayAdapter(Context context, ArrayList<SongItem> songItems) {
 		super(context, R.layout.each_song, songItems);
 		inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
 	}
 
 	@Override
-	public View getView(int position, View convertView, ViewGroup parent)
-	{
+	public View getView(int position, View convertView, ViewGroup parent) {
 		View row = convertView;
 		SongViewHolder songViewHolder;
-		if (row == null)
-		{
+		if (row == null) {
 			row = inflater.inflate(R.layout.playlist_each_song, parent, false);
 			songViewHolder = new SongViewHolder();
 			songViewHolder.songLabel = (TextView) row.findViewById(R.id.song_label);
 			songViewHolder.songIcon = (ImageView) row.findViewById(R.id.song_icon);
 			songViewHolder.songLableParent = (LinearLayout) row.findViewById(R.id.song_lable_parent_ll);
 			row.setTag(songViewHolder);
-		} else
-		{
+		} else {
 			songViewHolder = (SongViewHolder) row.getTag();
 		}
 		SongItem songItem = getItem(position);
 		return row;
 	}
 
-	static class SongViewHolder
-	{
+	static class SongViewHolder {
 		public LinearLayout songLableParent;
 		public TextView songLabel;
 		public ImageView songIcon;

src/com/w4rlock/backpapermusic/adapters/SongItemListDiaplayAdapter.java

 import com.w4rlock.backpapermusic.models.Song;
 import com.w4rlock.backpapermusic.models.SongItem;
 
-public class SongItemListDiaplayAdapter extends ArrayAdapter<SongItem>
-{
+public class SongItemListDiaplayAdapter extends ArrayAdapter<SongItem> {
 	private LayoutInflater inflater;
 
-	public SongItemListDiaplayAdapter(Context context, ArrayList<SongItem> songs)
-	{
+	public SongItemListDiaplayAdapter(Context context, ArrayList<SongItem> songs) {
 		super(context, R.layout.each_song, songs);
 		inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 	}
 
 	@Override
-	public View getView(int position, View convertView, ViewGroup parent)
-	{
+	public View getView(int position, View convertView, ViewGroup parent) {
 		View row = convertView;
 		SongViewHolder songViewHolder;
-		if (row == null)
-		{
+		if (row == null) {
 			row = inflater.inflate(R.layout.each_song, parent, false);
 			songViewHolder = new SongViewHolder();
 			songViewHolder.songLabel = (TextView) row.findViewById(R.id.song_label);
 			songViewHolder.songLableParent = (LinearLayout) row.findViewById(R.id.song_lable_parent_ll);
 			row.setTag(songViewHolder);
-		} else
-		{
+		} else {
 			songViewHolder = (SongViewHolder) row.getTag();
 		}
 		SongItem songItem = getItem(position);
 		songViewHolder.songLabel.setText(songItem.getTitle());
-		if (songItem.isSelected)
-		{
-			songViewHolder.songLableParent.setBackgroundColor(getContext().getResources().getColor(R.color.holo_blue_light));
-		} else
-		{
+		if (songItem.isSelected) {
+			songViewHolder.songLableParent.setBackgroundColor(getContext().getResources().getColor(
+					R.color.holo_blue_light));
+		} else {
 			songViewHolder.songLableParent.setBackgroundColor(getContext().getResources().getColor(R.color.white));
 		}
 		return row;
 	}
 
-	static class SongViewHolder
-	{
+	static class SongViewHolder {
 		public LinearLayout songLableParent;
 		public TextView songLabel;
 	}

src/com/w4rlock/backpapermusic/database/db/MusicDatabaseSQLiteOpenHelper.java

 
 import com.w4rlock.backpapermusic.models.Song;
 
-public class MusicDatabaseSQLiteOpenHelper extends SQLiteOpenHelper
-{
+public class MusicDatabaseSQLiteOpenHelper extends SQLiteOpenHelper {
 	private static final String DATABASE_NAME = "music_database.db";
 	private static final int DATABASE_VERSION = 1;
 
-	static
-	{
+	static {
 		// register our models
 		cupboard().register(Song.class);
 	}
 
-	public MusicDatabaseSQLiteOpenHelper(Context context)
-	{
+	public MusicDatabaseSQLiteOpenHelper(Context context) {
 		super(context, DATABASE_NAME, null, DATABASE_VERSION);
 	}
 
 	@Override
-	public void onCreate(SQLiteDatabase db)
-	{
+	public void onCreate(SQLiteDatabase db) {
 		// this will ensure that all tables are created
 		cupboard().withDatabase(db).createTables();
 		// add indexes and other database tweaks
 	}
 
 	@Override
-	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
-	{
+	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
 		// this will upgrade tables, adding columns and new tables.
 		// Note that existing columns will not be converted
 		cupboard().withDatabase(db).upgradeTables();
 		// do migration work
 	}
-	
+
 }

src/com/w4rlock/backpapermusic/database/db/MusicDb.java

 import android.content.Context;
 import android.database.sqlite.SQLiteDatabase;
 
-public class MusicDb
-{
-	public static SQLiteDatabase getWriteDatabase(Context context){
+public class MusicDb {
+	public static SQLiteDatabase getWriteDatabase(Context context) {
 		MusicDatabaseSQLiteOpenHelper sqliteHelper = new MusicDatabaseSQLiteOpenHelper(context);
 		return sqliteHelper.getWritableDatabase();
 	}
-	
-	public static SQLiteDatabase getReadDatabase(Context context){
+
+	public static SQLiteDatabase getReadDatabase(Context context) {
 		MusicDatabaseSQLiteOpenHelper sqliteHelper = new MusicDatabaseSQLiteOpenHelper(context);
 		return sqliteHelper.getReadableDatabase();
 	}

src/com/w4rlock/backpapermusic/database/service/MusicDatabaseSyncerService.java

 import com.w4rlock.backpapermusic.util.L;
 
 // using this as async task for now to test
-public class MusicDatabaseSyncerService extends AsyncTask<Void, Void, Void>
-{
+public class MusicDatabaseSyncerService extends AsyncTask<Void, Void, Void> {
 	private String url = "http://backpapermusic.w4rlock.in/api/music_list/";
 	private String modified_url = "http://backpapermusic.w4rlock.in/api/modified_date/";
 	private Context context;
 
 	private LoadingInterface loadingInterface;
 
-	public MusicDatabaseSyncerService(Context context, LoadingInterface loadingInterface)
-	{
+	public MusicDatabaseSyncerService(Context context, LoadingInterface loadingInterface) {
 		this.context = context;
 		this.loadingInterface = loadingInterface;
 	}
 
 	@Override
-	protected void onPreExecute()
-	{
+	protected void onPreExecute() {
 		loadingInterface.onLoadingStarted();
 		super.onPreExecute();
 	}
 
 	@Override
-	protected void onPostExecute(Void result)
-	{
+	protected void onPostExecute(Void result) {
 		loadingInterface.onLoadingEnded();
 		super.onPostExecute(result);
 	}
 
 	@Override
-	protected Void doInBackground(Void... params)
-	{
+	protected Void doInBackground(Void... params) {
 		L.d(DEBUG_TAG, "starting ");
 		boolean goForUpdate = false;
 		GetUrlRawData getUrlRawData = new GetUrlRawData();
 		Gson gson = new Gson();
 		DataSyncDate lastServerModifed = null;
-		try
-		{
+		try {
 			String lastModfiedResult = getUrlRawData.getData(modified_url);
 			lastServerModifed = gson.fromJson(lastModfiedResult, DataSyncDate.class);
 			L.d(DEBUG_TAG, "lastServerModifed.getGenerated_date: " + lastServerModifed.getGenerated_date());
 				goForUpdate = false;
 			else
 				goForUpdate = true;
-		} catch (Exception e1)
-		{
+		} catch (Exception e1) {
 			e1.printStackTrace();
 		}
-		if (!goForUpdate)
-		{
+		if (!goForUpdate) {
 			L.d(DEBUG_TAG, "go for update says there is no need to update the db so quitting");
 			return null;
 		}
-		try
-		{
+		try {
 			String result = getUrlRawData.getData(url);
 
 			ArrayList<ArrayList<Song>> music = new ArrayList<ArrayList<Song>>();
 
-			Type listType = new TypeToken<ArrayList<ArrayList<Song>>>()
-			{
+			Type listType = new TypeToken<ArrayList<ArrayList<Song>>>() {
 			}.getType();
 			music = gson.fromJson(result, listType);
 			SQLiteDatabase db = MusicDb.getWriteDatabase(context);
-			try
-			{
+			try {
 				L.d(DEBUG_TAG, "clearing all tables");
 				cupboard().withDatabase(db).dropAllTables();
 				cupboard().withDatabase(db).createTables();
 				L.d(DEBUG_TAG, "finished clearing all tables");
-			} catch (Exception e)
-			{
+			} catch (Exception e) {
 				L.d(DEBUG_TAG, "failed to drop and or create all tables");
 				e.printStackTrace();
 			}
 			int i = 0;
-			for (ArrayList<Song> songs : music)
-			{
+			for (ArrayList<Song> songs : music) {
 				i++;
 				L.d(DEBUG_TAG, "writing set element " + i);
 				cupboard().withDatabase(db).put(songs);
 			}
 			db.close();
 			L.d(DEBUG_TAG, "finished writing all set element ");
-		} catch (Exception e)
-		{
+		} catch (Exception e) {
 			L.d(DEBUG_TAG, "Error while fetching data " + e.toString());
 			e.printStackTrace();
 		}
 		Cursor songs = cupboard().withDatabase(db).query(Song.class).groupBy("dirname").getCursor();
 		QueryResultIterable<Song> itr = cupboard().withCursor(songs).iterate(Song.class);
 		L.d(DEBUG_TAG, "Calling results");
-		try
-		{
-			for (Song song : itr)
-			{
+		try {
+			for (Song song : itr) {
 				L.d(DEBUG_TAG, song.getDirname() + "/" + song.getAlbum() + "/" + song.getName());
 			}
-		} catch (Exception e)
-		{
+		} catch (Exception e) {
 			e.printStackTrace();
-		} finally
-		{
+		} finally {
 
 			// close the cursor
 			db.close();

src/com/w4rlock/backpapermusic/fragments/MusicListFragment.java

 import com.w4rlock.backpapermusic.util.L;
 import com.w4rlock.backpapermusic.views.SongDialogPopup;
 
-public class MusicListFragment extends Fragment
-{
+public class MusicListFragment extends Fragment {
 	private static final String DEBUG_TAG = "MusicListFragment";
 	public static final ArrayList<Song> musics = new ArrayList<Song>();
 	private BaseAdapter mBaseAdapter;
 	final MusicLoaderCallbacks musicLoaderCallbacks = new MusicLoaderCallbacks();
 	private static final int LOADER_ID = 0;
 
-	public MusicListFragment()
-	{
+	public MusicListFragment() {
 	}
 
 	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-	{
+	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		View rootView = inflater.inflate(R.layout.fragment_music_list, container, false);
 		setHasOptionsMenu(true);
 		songsList = (ListView) rootView.findViewById(R.id.songs_list_view);
 		songsGridView = (GridView) rootView.findViewById(R.id.songs_grid_view);
 		mViewFlipper = (ViewFlipper) rootView.findViewById(R.id.view_flipper);
-		songsList.setOnItemClickListener(new AdapterView.OnItemClickListener()
-		{
+		songsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 
 			@Override
-			public void onItemClick(AdapterView<?> parent, View view, int position, long id)
-			{
+			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
 				Song music = (Song) parent.getItemAtPosition(position);
 				showDialogWithSongs(music);
 			}
 		});
-		songsGridView.setOnItemClickListener(new AdapterView.OnItemClickListener()
-		{
+		songsGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 
 			@Override
-			public void onItemClick(AdapterView<?> parent, View view, int position, long id)
-			{
+			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
 				Song music = (Song) parent.getItemAtPosition(position);
 				showDialogWithSongs(music);
 			}
 		});
-		((Button) rootView.findViewById(R.id.stopService)).setOnClickListener(new View.OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.stopService)).setOnClickListener(new View.OnClickListener() {
 			@Override
-			public void onClick(View arg0)
-			{
+			public void onClick(View arg0) {
 				getActivity().startService(new Intent(MusicService.ACTION_QUIT));
 			}
 		});
-		((Button) rootView.findViewById(R.id.showPlayer)).setOnClickListener(new View.OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.showPlayer)).setOnClickListener(new View.OnClickListener() {
 			@Override
-			public void onClick(View arg0)
-			{
+			public void onClick(View arg0) {
 				Intent playerIntent = new Intent(getActivity(), MusicPlayerActivity.class);
 				playerIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
 				getActivity().startActivity(playerIntent);
 			}
 		});
-		((Button) rootView.findViewById(R.id.showPlaylist)).setOnClickListener(new View.OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.showPlaylist)).setOnClickListener(new View.OnClickListener() {
 			@Override
-			public void onClick(View arg0)
-			{
+			public void onClick(View arg0) {
 				Intent playerIntent = new Intent(getActivity(), MusicPlayListActivity.class);
 				playerIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
 				getActivity().startActivity(playerIntent);
 			}
 		});
 
-		((ImageView) rootView.findViewById(R.id.listview_icon)).setOnClickListener(new View.OnClickListener()
-		{
+		((ImageView) rootView.findViewById(R.id.listview_icon)).setOnClickListener(new View.OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				viewFlipperShowThisChild(0);
 			}
 		});
 
-		((ImageView) rootView.findViewById(R.id.gridview_icon)).setOnClickListener(new View.OnClickListener()
-		{
+		((ImageView) rootView.findViewById(R.id.gridview_icon)).setOnClickListener(new View.OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				viewFlipperShowThisChild(1);
 			}
 		});
 		return rootView;
 	}
 
-	private void viewFlipperShowThisChild(int whichChild)
-	{
-		switch (whichChild)
-		{
+	private void viewFlipperShowThisChild(int whichChild) {
+		switch (whichChild) {
 		case 0:
 			// show list view
 			songsGridView.setAdapter(null);
 		mViewFlipper.setDisplayedChild(whichChild);
 	}
 
-	private void loadData()
-	{
+	private void loadData() {
 		getLoaderManager().initLoader(LOADER_ID, null, musicLoaderCallbacks);
 	}
 
-	public void forceLoadDataFromLoader()
-	{
+	public void forceLoadDataFromLoader() {
 		L.d(DEBUG_TAG, "force load called ");
-		try
-		{
+		try {
 			getLoaderManager().restartLoader(0, null, musicLoaderCallbacks);
-		} catch (Exception e)
-		{
+		} catch (Exception e) {
 			L.d(DEBUG_TAG, "force load called but unable to fulfill it so failing silently");
 		}
 
 	}
 
-	final SongDialogPopup.OnSongItemClicked onItemClickListener = new SongDialogPopup.OnSongItemClicked()
-	{
+	final SongDialogPopup.OnSongItemClicked onItemClickListener = new SongDialogPopup.OnSongItemClicked() {
 		@Override
-		public void onSongItemClicked(ArrayList<SongItem> songItems)
-		{
+		public void onSongItemClicked(ArrayList<SongItem> songItems) {
 			addToPlayList(songItems);
 		}
 	};
 
-	protected void showDialogWithSongs(Song song)
-	{
+	protected void showDialogWithSongs(Song song) {
 
-		LoadSongsList.LoadSongsListCallback callback = new LoadSongsList.LoadSongsListCallback()
-		{
+		LoadSongsList.LoadSongsListCallback callback = new LoadSongsList.LoadSongsListCallback() {
 
 			@Override
-			public void onLoadingFinished(ArrayList<Song> songs)
-			{
+			public void onLoadingFinished(ArrayList<Song> songs) {
 				ArrayList<SongItem> songItems = new ArrayList<SongItem>();
-				for (Song song : songs)
-				{
+				for (Song song : songs) {
 					L.d(DEBUG_TAG, song.getName() + "/" + song.getDirname());
 					SongItem songItem = new SongItem(song);
 					songItems.add(songItem);
 		loadSongsList.execute(song);
 	}
 
-	protected void addToPlayList(ArrayList<SongItem> songItems)
-	{
+	protected void addToPlayList(ArrayList<SongItem> songItems) {
 		PlayList.addToPlayList(songItems);
 		Intent i = new Intent(MusicService.ACTION_PLAY);
 		getActivity().startService(i);
 	}
 
-	protected void playThisSong(SongItem songItem)
-	{
+	protected void playThisSong(SongItem songItem) {
 		String songUrl = songItem.getSongPath();
 		Intent i = new Intent(MusicService.ACTION_URL);
 		i.putExtra("song", songItem);
 
 	@SuppressLint("NewApi")
 	@Override
-	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
-	{
+	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
 		super.onCreateOptionsMenu(menu, inflater);
 		inflater.inflate(R.menu.music, menu);
 		SearchView searchView;
 			searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
 		else
 			searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
-		final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener()
-		{
+		final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
 			@Override
-			public boolean onQueryTextChange(String newText)
-			{
+			public boolean onQueryTextChange(String newText) {
 				L.d(DEBUG_TAG, "query: " + newText);
 				filterMusicItems(newText);
 				return true;
 			}
 
 			@Override
-			public boolean onQueryTextSubmit(String query)
-			{
+			public boolean onQueryTextSubmit(String query) {
 				return true;
 			}
 		};
 		searchView.setOnQueryTextListener(queryTextListener);
 	}
 
-	public void filterMusicItems(String newText)
-	{
-		if (newText == null || newText.length() <= 0)
-		{
+	public void filterMusicItems(String newText) {
+		if (newText == null || newText.length() <= 0) {
 			if (mViewFlipper.getDisplayedChild() == 0)
 				mBaseAdapter = new MusicListViewAdapter(getActivity(), musics);
 			else if (mViewFlipper.getDisplayedChild() == 1)
 				mBaseAdapter = new MusicGridViewAdapter(getActivity(), musics);
-		} else
-		{
+		} else {
 			List<Song> tempMusic = new ArrayList<Song>();
-			for (Song m : musics)
-			{
-				if (m.getAlbumName().toLowerCase().contains(newText) || m.getDirname().toLowerCase().contains(newText))
-				{
+			for (Song m : musics) {
+				if (m.getAlbumName().toLowerCase().contains(newText) || m.getDirname().toLowerCase().contains(newText)) {
 					tempMusic.add(m);
 				}
 			}
 	}
 
 	@Override
-	public void onResume()
-	{
+	public void onResume() {
 		super.onResume();
 	}
 
 	@Override
-	public void onPause()
-	{
+	public void onPause() {
 		super.onPause();
 	}
 
-	private class MusicLoaderCallbacks implements LoaderManager.LoaderCallbacks<AsyncResult<ArrayList<Song>>>
-	{
+	private class MusicLoaderCallbacks implements LoaderManager.LoaderCallbacks<AsyncResult<ArrayList<Song>>> {
 
 		@Override
-		public Loader<AsyncResult<ArrayList<Song>>> onCreateLoader(int id, Bundle args)
-		{
+		public Loader<AsyncResult<ArrayList<Song>>> onCreateLoader(int id, Bundle args) {
 			return new MusicDataLoader(getActivity());
 		}
 
 		@Override
-		public void onLoadFinished(Loader<AsyncResult<ArrayList<Song>>> loader, AsyncResult<ArrayList<Song>> data)
-		{
-			if (data.getResult() == null || data.isError())
-			{
-				Toast.makeText(getActivity(), "No Data Found locally and unable to fetch data online", Toast.LENGTH_LONG).show();
+		public void onLoadFinished(Loader<AsyncResult<ArrayList<Song>>> loader, AsyncResult<ArrayList<Song>> data) {
+			if (data.getResult() == null || data.isError()) {
+				Toast.makeText(getActivity(), "No Data Found locally and unable to fetch data online",
+						Toast.LENGTH_LONG).show();
 				return;
 			}
 			L.d("MusicLoaderCallbacks", data.getResult().size() + "");
-			if (data.isError())
-			{
+			if (data.isError()) {
 				return;
 			}
 			musics.clear();
-			for (Song m : data.getResult())
-			{
+			for (Song m : data.getResult()) {
 				musics.add(m);
 			}
 			if (mBaseAdapter != null)
 		}
 
 		@Override
-		public void onLoaderReset(Loader<AsyncResult<ArrayList<Song>>> loader)
-		{
+		public void onLoaderReset(Loader<AsyncResult<ArrayList<Song>>> loader) {
 
 		}
 

src/com/w4rlock/backpapermusic/fragments/MusicListLoaderFragment.java

 import com.w4rlock.backpapermusic.service.google.MusicService;
 import com.w4rlock.backpapermusic.util.L;
 
-public class MusicListLoaderFragment extends Fragment
-{
+public class MusicListLoaderFragment extends Fragment {
 
 	private static final String DEBUG_TAG = "MusicListLoaderFragment";
 	public static final ArrayList<Song> music = new ArrayList<Song>();
 	private static final int NETWORK_MAX_TRIES = 2;
 	private int networkTries = 0;
 
-	public MusicListLoaderFragment()
-	{
+	public MusicListLoaderFragment() {
 	}
 
 	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-	{
+	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		View rootView = inflater.inflate(R.layout.fragment_music, container, false);
 		ExpandableListView songsList = (ExpandableListView) rootView.findViewById(R.id.songs_list_view);
 		mMusicAdapter = new MusicListDisplayAdapter(getActivity(), music);
 		songsList.setAdapter(mMusicAdapter);
 		getLoaderManager().initLoader(0, null, new MusicLoaderCallbacks());
-		songsList.setOnChildClickListener(new ExpandableListView.OnChildClickListener()
-		{
+		songsList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
 
 			@Override
-			public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
-			{
+			public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
 				String CURRENT_SONG = music.get(groupPosition).getSongPath(childPosition);
 				playThisSong(groupPosition, childPosition);
 				L.d(DEBUG_TAG, CURRENT_SONG);
 				return true;
 			}
 		});
-		((Button) rootView.findViewById(R.id.stopService)).setOnClickListener(new View.OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.stopService)).setOnClickListener(new View.OnClickListener() {
 			@Override
-			public void onClick(View arg0)
-			{
+			public void onClick(View arg0) {
 				getActivity().startService(new Intent(MusicService.ACTION_QUIT));
 			}
 		});
-		((Button) rootView.findViewById(R.id.showPlayer)).setOnClickListener(new View.OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.showPlayer)).setOnClickListener(new View.OnClickListener() {
 			@Override
-			public void onClick(View arg0)
-			{
+			public void onClick(View arg0) {
 				Intent playerIntent = new Intent(getActivity(), MusicPlayerActivity.class);
 				playerIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
 				getActivity().startActivity(playerIntent);
 		return rootView;
 	}
 
-	protected void playThisSong(int groupPosition, int childPosition)
-	{
-//		SongItem songItem = new SongItem(music.get(groupPosition), childPosition);
-//		String songUrl = music.get(groupPosition).getSongPath(childPosition);
-//		Intent i = new Intent(MusicService.ACTION_URL);
-//		i.putExtra("song", songItem);
-//		Uri uri = Uri.parse(songUrl);
-//		i.setData(uri);
-//		getActivity().startService(i);
+	protected void playThisSong(int groupPosition, int childPosition) {
+		// SongItem songItem = new SongItem(music.get(groupPosition),
+		// childPosition);
+		// String songUrl = music.get(groupPosition).getSongPath(childPosition);
+		// Intent i = new Intent(MusicService.ACTION_URL);
+		// i.putExtra("song", songItem);
+		// Uri uri = Uri.parse(songUrl);
+		// i.setData(uri);
+		// getActivity().startService(i);
 	}
 
-	private class MusicLoaderCallbacks implements LoaderManager.LoaderCallbacks<AsyncResult<ArrayList<Song>>>
-	{
+	private class MusicLoaderCallbacks implements LoaderManager.LoaderCallbacks<AsyncResult<ArrayList<Song>>> {
 
 		@Override
-		public Loader<AsyncResult<ArrayList<Song>>> onCreateLoader(int id, Bundle args)
-		{
+		public Loader<AsyncResult<ArrayList<Song>>> onCreateLoader(int id, Bundle args) {
 			return new MusicDataLoader(getActivity());
 		}
 
 		@Override
-		public void onLoadFinished(Loader<AsyncResult<ArrayList<Song>>> loader, AsyncResult<ArrayList<Song>> data)
-		{
+		public void onLoadFinished(Loader<AsyncResult<ArrayList<Song>>> loader, AsyncResult<ArrayList<Song>> data) {
 			networkTries += 1;
-			if (data.getResult() == null)
-			{
-				if (networkTries <= NETWORK_MAX_TRIES)
-				{
+			if (data.getResult() == null) {
+				if (networkTries <= NETWORK_MAX_TRIES) {
 					L.d("MusicLoaderCallbacks", "null data retrying");
 					loader.reset();
 					getLoaderManager().restartLoader(loader.getId(), null, this);
 				return;
 			}
 			L.d("MusicLoaderCallbacks", data.getResult().size() + "");
-			if (data.isError())
-			{
+			if (data.isError()) {
 				return;
 			}
 			music.clear();
 			networkTries = 0;
-			for (Song m : data.getResult())
-			{
+			for (Song m : data.getResult()) {
 				music.add(m);
 			}
 			mMusicAdapter.notifyDataSetChanged();
 		}
 
 		@Override
-		public void onLoaderReset(Loader<AsyncResult<ArrayList<Song>>> loader)
-		{
+		public void onLoaderReset(Loader<AsyncResult<ArrayList<Song>>> loader) {
 
 		}
 
 	}
 
 	@Override
-	public void onResume()
-	{
+	public void onResume() {
 		super.onResume();
 	}
 
 	@Override
-	public void onPause()
-	{
+	public void onPause() {
 		super.onPause();
 	}
 }

src/com/w4rlock/backpapermusic/fragments/MusicPlayListFragment.java

 import com.w4rlock.backpapermusic.service.PlayList;
 import com.w4rlock.backpapermusic.service.google.MusicService;
 
-public class MusicPlayListFragment extends Fragment
-{
-	public MusicPlayListFragment()
-	{
+public class MusicPlayListFragment extends Fragment {
+	public MusicPlayListFragment() {
 	}
 
 	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-	{
+	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		View rootView = inflater.inflate(R.layout.fragment_music_play_list, container, false);
-		final PlayListDisplayAdapter playListDisplayAdapter = new PlayListDisplayAdapter(getActivity(), PlayList.playList);
+		final PlayListDisplayAdapter playListDisplayAdapter = new PlayListDisplayAdapter(getActivity(),
+				PlayList.playList);
 		ListView listView = (ListView) rootView.findViewById(R.id.musicPlaylistListView);
 		listView.setAdapter(playListDisplayAdapter);
-		listView.setOnItemClickListener(new OnItemClickListener()
-		{
+		listView.setOnItemClickListener(new OnItemClickListener() {
 			@Override
-			public void onItemClick(AdapterView<?> parent, View view, int position, long id)
-			{		
+			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
 				PlayList.moveNthPosToFirst(position);
 				playListDisplayAdapter.notifyDataSetChanged();
 				Intent i = new Intent(MusicService.ACTION_URL);

src/com/w4rlock/backpapermusic/fragments/MusicPlayerFragment.java

 import com.w4rlock.backpapermusic.util.L;
 import com.w4rlock.backpapermusic.util.Utils;
 
-public class MusicPlayerFragment extends Fragment implements MusicServiceCallbackInterface
-{
+public class MusicPlayerFragment extends Fragment implements MusicServiceCallbackInterface {
 	private static final String DEBUG_TAG = MusicPlayerFragment.class.toString();
 
 	@Override
-	public void onStart()
-	{
+	public void onStart() {
 		super.onStart();
 		attachToService();
 	}
 
-	private void attachToService()
-	{
+	private void attachToService() {
 		// Bind to LocalService
 		if (Utils.isMusicServiceRunning(getActivity()))
 		// binding only if music
 		}
 	}
 
-	private void detachFromService()
-	{
+	private void detachFromService() {
 		// Unbind from the service
-		if (mBound)
-		{
+		if (mBound) {
 			getActivity().unbindService(mConnection);
 			mBound = false;
 		}
 	}
 
 	@Override
-	public void onStop()
-	{ 
+	public void onStop() {
 		super.onStop();
 		detachFromService();
 	}
 	private TextView mMediaPercent;
 
 	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-	{
+	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		View rootView = inflater.inflate(R.layout.fragment_music_player, container, false);
 		mSongDetails = (TextView) rootView.findViewById(R.id.songDetails);
 		mSeekBarPlayer = (SeekBar) rootView.findViewById(R.id.playerSeekbar);
 		mMediaTime = (TextView) rootView.findViewById(R.id.mediaTime);
 		mSongThumb = (ImageView) rootView.findViewById(R.id.songThumb);
 		mMediaPercent = (TextView) rootView.findViewById(R.id.mediaPercent);
-		mSeekBarPlayer.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
-		{
+		mSeekBarPlayer.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
 			int progress;
 			boolean fromUser;
 
 			@Override
-			public void onStopTrackingTouch(SeekBar seekBar)
-			{
+			public void onStopTrackingTouch(SeekBar seekBar) {
 				L.d(DEBUG_TAG, "onStopTrackingTouch");
-				if (fromUser && mPlayer.isPlaying())
-				{
+				if (fromUser && mPlayer.isPlaying()) {
 					mPlayer.seekTo(progress);
 				}
 			}
 
 			@Override
-			public void onStartTrackingTouch(SeekBar seekBar)
-			{
+			public void onStartTrackingTouch(SeekBar seekBar) {
 				L.d(DEBUG_TAG, "onStartTrackingTouch");
 			}
 
 			@Override
-			public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
-			{
+			public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
 				this.fromUser = fromUser;
 				this.progress = progress;
 			}
 		});
 
-		((Button) rootView.findViewById(R.id.pauseButton)).setOnClickListener(new OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.pauseButton)).setOnClickListener(new OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				getActivity().startService(new Intent(MusicService.ACTION_PAUSE));
 			}
 		});
 
-		((Button) rootView.findViewById(R.id.nextButton)).setOnClickListener(new OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.nextButton)).setOnClickListener(new OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				getActivity().startService(new Intent(MusicService.ACTION_SKIP));
 			}
 		});
-		((Button) rootView.findViewById(R.id.previousButton)).setOnClickListener(new OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.previousButton)).setOnClickListener(new OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				getActivity().startService(new Intent(MusicService.ACTION_REWIND));
 			}
 		});
-		((Button) rootView.findViewById(R.id.playButton)).setOnClickListener(new OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.playButton)).setOnClickListener(new OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				detachFromService();
 				getActivity().startService(new Intent(MusicService.ACTION_PLAY));
 				attachToService();
 			}
 		});
 
-		((Button) rootView.findViewById(R.id.stopButton)).setOnClickListener(new OnClickListener()
-		{
+		((Button) rootView.findViewById(R.id.stopButton)).setOnClickListener(new OnClickListener() {
 
 			@Override
-			public void onClick(View v)
-			{
+			public void onClick(View v) {
 				getActivity().startService(new Intent(MusicService.ACTION_STOP));
 			}
 		});
 		return rootView;
 	}
 
-	private void writeSongDetails(SongItem songItem, boolean onPreperaing)
-	{
+	private void writeSongDetails(SongItem songItem, boolean onPreperaing) {
 		mSongItem = songItem;
 		writeSongDetails(onPreperaing);
 	}
 
-	private void writeSongDetails(boolean onPreparing)
-	{
-		if (mSongItem != null)
-		{
+	private void writeSongDetails(boolean onPreparing) {
+		if (mSongItem != null) {
 			mSongDetails.setText(mSongItem.getTitle() + " - " + mSongItem.getAlbum() + " - " + mSongItem.getArtist()
 					+ (onPreparing ? " (Loading)" : " (Playing)"));
 			GetThumbnailDrawable getThumbnailDrawable = new GetThumbnailDrawable(mSongItem);
 			getThumbnailDrawable.execute();
-		} else
-		{
+		} else {
 			mSeekBarPlayer.setMax(0);
 			mSeekBarPlayer.setProgress(0);
 			mSongDetails.setText(getActivity().getString(R.string.playing_nothing));
 
 	}
 
-	protected void attachMusicPlayerCallbacks()
-	{
+	protected void attachMusicPlayerCallbacks() {
 		mMusicService.unregisterCallbackListener(MusicPlayerFragment.this);
 		mMusicService.registerCallbackListener(MusicPlayerFragment.this);
 	}
 
-	protected void detachMusicPlayerCallbacks()
-	{
+	protected void detachMusicPlayerCallbacks() {
 		if (mMusicService != null)
 			mMusicService.unregisterCallbackListener(MusicPlayerFragment.this);
 		mPlayer = null;
 	}
 
-	private ServiceConnection mConnection = new ServiceConnection()
-	{
+	private ServiceConnection mConnection = new ServiceConnection() {
 
 		@Override
-		public void onServiceDisconnected(ComponentName name)
-		{
+		public void onServiceDisconnected(ComponentName name) {
 			mBound = false;
 			detachMusicPlayerCallbacks();
 		}
 
 		@Override
-		public void onServiceConnected(ComponentName name, IBinder service)
-		{
+		public void onServiceConnected(ComponentName name, IBinder service) {
 			// We've bound to LocalService, cast the IBinder and get
 			// LocalService instance
 			MusicServiceBinder binder = (MusicServiceBinder) service;
 	};
 
 	@Override
-	public void onSongChanged(SongItem songItem)
-	{
+	public void onSongChanged(SongItem songItem) {
 		L.d(DEBUG_TAG, "onSongChanged");
 	}
 
 	@Override
-	public void onStateChanged(State state)
-	{
+	public void onStateChanged(State state) {