Android Open Source - ElyTheme Icon Activity






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

/*
 * Copyright (C) 2013 Andreas Stuetz <andreas.stuetz@gmail.com>
 */*from   ww  w  .j a  v  a 2s . com*/
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package it.gcaliendo.elytheme;


import java.util.Locale;

import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.ShareCompat;
import android.support.v4.view.ViewPager;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ShareActionProvider;

import com.astuetz.PagerSlidingTabStrip;
import it.gcaliendo.elytheme.iconfragment.IconFragmentGames;
import it.gcaliendo.elytheme.iconfragment.IconFragmentLatest;
import it.gcaliendo.elytheme.iconfragment.IconFragmentMisc;
import it.gcaliendo.elytheme.iconfragment.IconFragmentPlay;
import it.gcaliendo.elytheme.iconfragment.IconFragmentSystem;


public class IconActivity extends FragmentActivity{

  private final Handler handler = new Handler();
  private PagerSlidingTabStrip tabs;
  private ViewPager pager;
  private IconPagerAdapter adapter;
  private ShareActionProvider mShareActionProvider;
  private Intent mShareIntent;
  private int indicatorColor = 0xFF3F9FE0;
  private int tabTextColor = 0xFF666666;
  
    //This activity is what displays the icon fragments (the icon categories) see iconfragment for the tabs themselves
     @Override
      public void onCreate(Bundle savedInstanceState) {

          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_icon);
      mShareIntent = new Intent();
      mShareIntent.setAction(Intent.ACTION_SEND);
      mShareIntent.setType("text/plain");
      mShareIntent.putExtra(Intent.EXTRA_TEXT, "From me to you, this text is new.");

          
          tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
      ViewPager pager = (ViewPager) findViewById(R.id.pager);
    
      adapter = new IconPagerAdapter(getSupportFragmentManager());

      pager.setAdapter(adapter);
      

      final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
          .getDisplayMetrics());
      pager.setPageMargin(pageMargin);

      tabs.setViewPager(pager);

      }
  


  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.share_menu, menu);
      MenuItem item = menu.findItem(R.id.menu_item_share);
      mShareActionProvider = (ShareActionProvider) item.getActionProvider();
      // Create the share Intent
      String playStoreLink = "https://play.google.com/store/apps/details?id=" +
          getPackageName();
      String yourShareText = getString(R.string.share_this) + playStoreLink;
      Intent shareIntent = ShareCompat.IntentBuilder.from(this)
          .setType("text/plain").setText(yourShareText).getIntent();
      // Set the share Intent
      mShareActionProvider.setShareIntent(shareIntent);
      return true;
  }


  public class IconPagerAdapter extends FragmentPagerAdapter {

    private final int[] TITLES = { R.string.icon1, R.string.icon2, R.string.icon3, R.string.icon4, R.string.icon5 };

    public IconPagerAdapter(FragmentManager fm) {
      super(fm);
    }

    @Override
    public CharSequence getPageTitle(int position) {
      Locale l = Locale.getDefault();
      switch (position) {
      case 0:
        return getString(R.string.icon1).toUpperCase(l);
      case 1:
        return getString(R.string.icon2).toUpperCase(l);
      case 2:
        return getString(R.string.icon3).toUpperCase(l);
      case 3:
        return getString(R.string.icon4).toUpperCase(l);
      case 4:
        return getString(R.string.icon5).toUpperCase(l);  
      }
      return null;
    }

    @Override
    public Fragment getItem(int position) {
      Fragment f = new Fragment();
      switch(position){
      case 0:
        f= new IconFragmentLatest();  
        break;
      case 1:
        f= new IconFragmentSystem();
        break;
      case 2:
        f= new IconFragmentPlay();  
        break;
      case 3:
        f= new IconFragmentGames();  
        break;
      case 4:
        f= new IconFragmentMisc();  
        break;  
      }
      return f;
    }
    
    @Override
    public int getCount() {
      return TITLES.length;
    }  
    
  }

}




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