Android Open Source - ElyTheme Icon Fragment Play






From Project

Back to project page ElyTheme.

License

The source code is released under:

GNU General Public License

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

/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */
/*from   w  w  w . j av  a  2s. c o m*/
package it.gcaliendo.elytheme.iconfragment;

import it.gcaliendo.elytheme.IconsProvider;
import it.gcaliendo.elytheme.R;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;

import java.util.ArrayList;

  public class IconFragmentPlay extends Fragment implements AdapterView.OnItemClickListener{
      private static final String RESULT_OK = null;
    public Uri CONTENT_URI;

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

      View view = inflater.inflate(R.layout.icon_main, container, false);
          int iconSize=getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
          GridView gridview = (GridView) view.findViewById(R.id.icon_grid);
          gridview.setNumColumns(4);
          gridview.setColumnWidth(iconSize);
          gridview.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
          gridview.setVerticalSpacing(iconSize/2);
          gridview.setOnItemClickListener(this);
          gridview.setAdapter(new IconAdapter(getActivity(), iconSize));
          gridview.setOnItemClickListener(this);
          CONTENT_URI=Uri.parse("content://"+ IconsProvider.class.getCanonicalName());
      return view;
      
      }

    @Override
      public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
          String icon=adapterView.getItemAtPosition(i).toString();
          Intent result = new Intent(null, Uri.withAppendedPath(CONTENT_URI,icon));
          setResult(RESULT_OK, result);
          finish();
      }
      private void setResult(String resultOk, Intent result) {
      // TODO Auto-generated method stub

    }

    private void finish() {
      // TODO Auto-generated method stub

    }
    private class IconAdapter extends BaseAdapter{
      private Context mContext;
      private int mIconSize;
      public IconAdapter(Context mContext, int iconsize) {
        this.mContext = mContext;
        this.mIconSize = iconsize;
        loadIcon();
      }

          @Override
          public int getCount() {
              return mThumbs.size();
          }

          @Override
          public Object getItem(int position) {
              return mThumbs.get(position);
          }

          @Override
          public long getItemId(int position) {
              return position;
          }

          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              ImageView imageView;
              if (convertView == null) {
                  imageView = new ImageView(mContext);
                  imageView.setLayoutParams(new GridView.LayoutParams(144, 144));
              } else {
                  imageView = (ImageView) convertView;
              }
              imageView.setImageResource(mThumbs.get(position));
              return imageView;
      }

          private ArrayList<Integer> mThumbs;
          ////////////////////////////////////////////////
          private void loadIcon() {
              mThumbs = new ArrayList<Integer>();

              final Resources resources = getResources();
              final String packageName = getActivity().getApplication().getPackageName();

              addIcon(resources, packageName, R.array.playicons);

          }
          private void addIcon(Resources resources, String packageName, int list) {
              final String[] extras = resources.getStringArray(list);
              for (String extra : extras) {
                  int res = resources.getIdentifier(extra, "drawable", packageName);
                  if (res != 0) {
                      final int thumbRes = resources.getIdentifier(extra,"drawable", packageName);
                      if (thumbRes != 0) {
                          mThumbs.add(thumbRes);
                      }
                  }
              }
          }

      }
  }




Java Source Code List

com.afollestad.cardsui.ApplicationTest.java
com.afollestad.cardsui.CardAdapter.java
com.afollestad.cardsui.CardBase.java
com.afollestad.cardsui.CardCenteredHeader.java
com.afollestad.cardsui.CardCompressed.java
com.afollestad.cardsui.CardCursorAdapter.java
com.afollestad.cardsui.CardHeader.java
com.afollestad.cardsui.CardListView.java
com.afollestad.cardsui.CardTheme.java
com.afollestad.cardsui.Card.java
com.afollestad.silk.ApplicationTest.java
com.afollestad.silk.SilkComparable.java
com.afollestad.silk.SilkCursorItem.java
com.afollestad.silk.Silk.java
com.afollestad.silk.activities.SilkDrawerActivity.java
com.afollestad.silk.adapters.ScrollStatePersister.java
com.afollestad.silk.adapters.SilkAdapter.java
com.afollestad.silk.adapters.SilkCursorAdapter.java
com.afollestad.silk.adapters.SilkSpinnerAdapter.java
com.afollestad.silk.dialogs.SilkDialog.java
com.afollestad.silk.fragments.feed.SilkCursorFeedFragment.java
com.afollestad.silk.fragments.feed.SilkFeedFragment.java
com.afollestad.silk.fragments.list.SilkCursorListFragment.java
com.afollestad.silk.fragments.list.SilkListFragment.java
com.afollestad.silk.http.SilkHttpBase.java
com.afollestad.silk.http.SilkHttpBody.java
com.afollestad.silk.http.SilkHttpCallback.java
com.afollestad.silk.http.SilkHttpClient.java
com.afollestad.silk.http.SilkHttpException.java
com.afollestad.silk.http.SilkHttpHeader.java
com.afollestad.silk.http.SilkHttpResponse.java
com.afollestad.silk.utilities.IOUtils.java
com.afollestad.silk.utilities.TimeUtils.java
com.afollestad.silk.views.ClickableToast.java
com.afollestad.silk.views.list.OnSilkScrollListener.java
com.afollestad.silk.views.list.SilkGridView.java
com.afollestad.silk.views.list.SilkListView.java
com.afollestad.silk.views.time.SilkDatePicker.java
it.gcaliendo.elytheme.Adw.java
it.gcaliendo.elytheme.ApplicationTest.java
it.gcaliendo.elytheme.DocksProvider.java
it.gcaliendo.elytheme.Docks.java
it.gcaliendo.elytheme.IconActivity.java
it.gcaliendo.elytheme.IconPack.java
it.gcaliendo.elytheme.IconsProvider.java
it.gcaliendo.elytheme.Icons.java
it.gcaliendo.elytheme.RequestActivity.java
it.gcaliendo.elytheme.ThemeActivity.java
it.gcaliendo.elytheme.Wallpaper.java
it.gcaliendo.elytheme.fragments.FragmentAbout.java
it.gcaliendo.elytheme.fragments.FragmentContact.java
it.gcaliendo.elytheme.fragments.FragmentExtras.java
it.gcaliendo.elytheme.fragments.FragmentTheme.java
it.gcaliendo.elytheme.helper.AppInfo.java
it.gcaliendo.elytheme.iconfragment.IconFragmentGames.java
it.gcaliendo.elytheme.iconfragment.IconFragmentLatest.java
it.gcaliendo.elytheme.iconfragment.IconFragmentMisc.java
it.gcaliendo.elytheme.iconfragment.IconFragmentPlay.java
it.gcaliendo.elytheme.iconfragment.IconFragmentSystem.java