[Android Themes] fraom:
is for the card

this is my code for MainFragment.java

-----------------------------------------------

package your.icons.name.here.fragment;

import java.util.ArrayList;

import java.util.List;

import view.ScrollGridView;

import your.icons.name.here.R;

import your.icons.name.here.activity.AboutThemeActivity;

import your.icons.name.here.activity.AllIcons;

import your.icons.name.here.activity.ApplyLauncherMain;

import your.icons.name.here.activity.MainActivity;

import your.icons.name.here.activity.RequestActivity;

import your.icons.name.here.activity.Wallpaper;

import your.icons.name.here.adapter.MainAdapter;

import your.icons.name.here.adapter.MainAdapter.AdapterItem;

import android.content.Intent;

import android.net.Uri;

import android.os.Bundle;

import android.view.LayoutInflater;

import android.view.View;

import android.view.ViewGroup;

import android.widget.AdapterView;

import android.widget.AdapterView.OnItemClickListener;

import com.actionbarsherlock.app.SherlockFragment;

/**

** Some lines may be off a few numbers

** Just be sure you're in the general area

**/

public class MainFragment extends SherlockFragment{

ScrollGridView gridView;

final List<AdapterItem> listOfStuff = new ArrayList<AdapterItem>();

public static final int APPLY = 0;

public static final int WALLPAPER = 1;

public static final int ALLICONS = 2;

public static final int SCREEN = 3;

public static final int REQUEST = 4;

public static final int PLAY = 5;

public static final int DEVG = 6;

public static final int GCOMMUNITY = 7;

public static final int TWITTER = 8;

public static final int FACEBOOK = 9;

public static final int WEB = 10;

public static final int CONTACT = 11;

// This is the background layout that gets inflated behind the list view

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){

return inflater.inflate(R.layout.gridview_behind, null);

}

// Starts when the MainFragment is launched

@override

public void onActivityCreated(Bundle savedInstanceState){

super.onActivityCreated(savedInstanceState);

/*

* This part does two things

* First - It counts the number of items and displays them

* Second - It displays the text in the "" which is a brief description of that item

* Removing any of these will remove that item but be sure to edit ALL the cases below or your list

* won't line up properly

*/

/**

** NOTE: in order to have different views on tablet vs phones, I added an if/else statement to this

** section. Be sure to remove BOTH parts to remove it from phones and tablets. Failure to remove both

** parts will result in the app functioning differently on phones and tablets.

**/

/*

* Sets the Title and description text for each GridView item

* Check res/values/strings.xml to change text to whatever you want each GridView to say

*/

boolean tabletSize = getResources().getBoolean(R.bool.isTablet);

if (tabletSize) {

gridView = (ScrollGridView)getView().findViewById(R.id.grid);

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_apply),

getResources().getString (R.string.desc_apply), 0));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_walls),

getResources().getString (R.string.desc_walls), 1));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_icons),

getResources().getString (R.string.desc_icons), 2));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_screen),

getResources().getString (R.string.desc_screen), 3));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_request),

getResources().getString (R.string.desc_request), 4));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_play),

getResources().getString (R.string.desc_play), 5));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_dev),

getResources().getString (R.string.desc_dev), 6));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_community),

getResources().getString (R.string.desc_community), 7));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_twitter),

getResources().getString (R.string.desc_twitter), 8));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_fb),

getResources().getString (R.string.desc_fb), 9));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_web),

getResources().getString (R.string.desc_web), 10));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_contact),

getResources().getString (R.string.desc_contact), 11));

} else {

gridView = (ScrollGridView)getView().findViewById(R.id.grid);

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_apply),

getResources().getString (R.string.desc_apply), 0));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_walls),

getResources().getString (R.string.desc_walls), 1));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_icons),

getResources().getString (R.string.desc_icons), 2));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_screen),

getResources().getString (R.string.desc_screen), 3));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_request),

getResources().getString (R.string.desc_request), 4));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_play),

getResources().getString (R.string.desc_play), 5));

listOfStuff.add(new AdapterItem(getResources().getString (R.string.title_dev),

getResources().getString (R.string.desc_dev), 6));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_community),

getResources().getString (R.string.desc_community), 7));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_twitter),

getResources().getString (R.string.desc_twitter), 8));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_fb),

getResources().getString (R.string.desc_fb), 9));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_web),

getResources().getString (R.string.desc_web), 10));

listOfStuff.remove(new AdapterItem(getResources().getString (R.string.title_contact),

getResources().getString (R.string.desc_contact), 11));

}

/**

** NOTE: in order to have different views on tablet vs phones, I added an if/else statement to this

** section. Be sure to remove both parts to remove it from phones and tablets. Failure to remove both

** parts will result in the app functioning differently on phones and tablets.

**/

MainAdapter adapter = new MainAdapter(getActivity(), listOfStuff);

gridView.setAdapter(adapter);

gridView.setExpanded(true);

gridView.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

@SuppressWarnings("unused")

MainFragment gridContentT = null;

boolean tabletSize = getResources().getBoolean(R.bool.isTablet);

if (tabletSize) { // For TABLETS

switch (position) {

case APPLY:

Intent launcher = new Intent(getSherlockActivity(), ApplyLauncherMain.class);

startActivity(launcher);

break;

case WALLPAPER:

Intent wall = new Intent(getSherlockActivity(), Wallpaper.class);

startActivity(wall);

break;

case ALLICONS:

Intent allIcons = new Intent(getSherlockActivity(), AllIcons.class);

startActivity(allIcons);

break;

case REQUEST:

Intent request = new Intent(getSherlockActivity(), RequestActivity.class);

startActivity(request);

break;

case SCREEN:

Intent aboutTheme = new Intent(getSherlockActivity(), AboutThemeActivity.class);

startActivity(aboutTheme);

break;

case DEVG:

Intent dev = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://plus.google.com/+DevFraom"));

startActivity(dev);

break;

case GCOMMUNITY:

Intent community = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://plus.google.com/communities/114921114033302801523"));

startActivity(community);

break;

case TWITTER:

Intent twitter = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://twitter.com/Fraom"));

startActivity(twitter);

break;

case FACEBOOK:

Intent fb = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://www.facebook.com/devFraom"));

startActivity(fb);

break;

case WEB:

Intent web = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("http://zeptorius.altervista.org"));

startActivity(web);

break;

case CONTACT:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]

{getResources().getString(R.string.email_address)});

emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,

getResources().getText(R.string.email_subject));

emailIntent.setType("plain/text");

startActivity(Intent.createChooser(emailIntent, "Contact Developer"));

break;

}

} else { // For PHONES

switch (position) {

case APPLY:

Intent launcher = new Intent(getSherlockActivity(), ApplyLauncherMain.class);

startActivity(launcher);

break;

case WALLPAPER:

Intent wall = new Intent(getSherlockActivity(), Wallpaper.class);

startActivity(wall);

break;

case ALLICONS:

Intent allIcons = new Intent(getSherlockActivity(), AllIcons.class);

startActivity(allIcons);

break;

case REQUEST:

Intent request = new Intent(getSherlockActivity(), RequestActivity.class);

startActivity(request);

break;

case SCREEN:

Intent aboutTheme = new Intent(getSherlockActivity(), AboutThemeActivity.class);

startActivity(aboutTheme);

break;

case DEVG:

Intent dev = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://plus.google.com/+DevFraom"));

startActivity(dev);

break;

case GCOMMUNITY:

Intent community = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://plus.google.com/communities/114921114033302801523"));

startActivity(community);

break;

case TWITTER:

Intent twitter = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://twitter.com/Fraom"));

startActivity(twitter);

break;

case FACEBOOK:

Intent fb = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("https://www.facebook.com/devFraom"));

startActivity(fb);

break;

case WEB:

Intent web = new Intent(Intent.ACTION_VIEW).setData(Uri.parse

("http://zeptorius.altervista.org"));

startActivity(web);

break;

case CONTACT:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]

{getResources().getString(R.string.email_address)});

emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,

getResources().getText(R.string.email_subject));

emailIntent.setType("plain/text");

startActivity(Intent.createChooser(emailIntent, "Contact Developer"));

break;

}

}

}

});

}

}

----------------------------

and this is the MainAdapter.java

package your.icons.name.here.adapter;

import android.content.Context;

import android.graphics.Typeface;

import android.view.LayoutInflater;

import android.view.View;

import android.view.ViewGroup;

import android.widget.BaseAdapter;

import android.widget.ImageView;

import android.widget.TextView;

import java.util.List;

import your.icons.name.here.R;

public class MainAdapter extends BaseAdapter{

public static final int APPLY = 0;

public static final int WALLPAPER = 1;

public static final int ALLICONS = 2;

public static final int SCREEN = 3;

public static final int REQUEST = 4;

public static final int PLAY = 5;

public static final int DEVG = 6;

public static final int GCOMMUNITY = 7;

public static final int TWITTER = 8;

public static final int FACEBOOK = 9;

public static final int WEB = 10;

public static final int CONTACT = 11;

private Context context;

private List<AdapterItem> gridItem;

public MainAdapter(Context context, List<AdapterItem> gridItem) {

this.gridItem = gridItem;

this.context = context;

}

public View getView(int position, View v, ViewGroup parent) {

ViewHolder holder;

AdapterItem entry = gridItem.get(position);

if (v == null) {

LayoutInflater inflater = (LayoutInflater) context

.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

v = inflater.inflate(R.layout.gridview_layout, null);

holder = new ViewHolder();

holder.title = (TextView) v.findViewById(R.id.title);

holder.text = (TextView) v.findViewById(R.id.description);

holder.icon_Image = (ImageView) v.findViewById(R.id.list_image);

v.setTag(holder);

}

else {

holder = (ViewHolder) v.getTag();

}

holder.title.setText(entry.getTitle());

/*

* Sets the font type for the title and description of each item

* This is if you want to have a bolder font for title or something

* Make sure the font file is in the projects Asset folder

* Default for this template is Roboto-Thin

* themefont.ttf is the font the theme grabs also

*/

Typeface tfTitle = Typeface.createFromAsset(context.getAssets(),"themefont.ttf");

Typeface tfDescription = Typeface.createFromAsset(context.getAssets(),"themefont.ttf");

holder.title.setTypeface(tfTitle);

holder.text.setTypeface(tfDescription);

/*

* Sets the description and title text color as well as icon shown

* You can reference any color in the colors.xml and even add some

* You can also individually set the color for each GridView by

* referencing a different color on each case statement (kinda like the different icon references)

* You can reference any drawable

*/

switch(entry.getID()){

case APPLY:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_launcher);

break;

case WALLPAPER:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_wall);

break;

case ALLICONS:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_oss);

break;

case SCREEN:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_info);

break;

case REQUEST:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_request);

break;

case PLAY:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_oss);

break;

case DEVG:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_gplus);

break;

case GCOMMUNITY:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_community);

break;

case TWITTER:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_twitter);

break;

case FACEBOOK:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_oss);

break;

case WEB:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_oss);

break;

case CONTACT:

holder.title.setTextColor(context.getResources().getColor(R.color.list_title_color));

holder.text.setTextColor(context.getResources().getColor(R.color.list_desc_color));

holder.icon_Image.setImageResource(R.drawable.icon_email);

break;

}

holder.text.setText(entry.getDescription());

holder.title.setText(entry.getTitle());

return v;

}

@override

public int getCount() {

return gridItem.size();

}

@override

public Object getItem(int position) {

return gridItem.get(position);

}

@override

public long getItemId(int position) {

return position;

}

public static class ViewHolder {

public TextView title;

public TextView text;

public ImageView icon_Image;

}

public static class AdapterItem{

String Title;

String Description;

int ID;

public AdapterItem(String Title, String Description, int ID) {

this.Title = Title;

this.Description = Description;

this.ID = ID;

}

public String getTitle() {

return Title;

}

public String getDescription() {

return Description;

}

public int getID() {

return ID;

}

}

}

-----------------

the cards show about the number 6 , others ( community, twitter, Facebook, web e contact ) doesn't appears!

i ve attached the file, can you see it ?