Android Open Source - ElyTheme Fragment Contact






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

/*
 *//from  w ww . j a  va2 s  .co m
 * 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.fragments;


import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Toast;

import com.afollestad.cardsui.Card;
import com.afollestad.cardsui.CardAdapter;
import com.afollestad.cardsui.CardBase;
import com.afollestad.cardsui.CardHeader;
import com.afollestad.cardsui.CardListView;
import com.afollestad.cardsui.CardListView.CardClickListener;
import it.gcaliendo.elytheme.R;
import it.gcaliendo.elytheme.R.drawable;
import it.gcaliendo.elytheme.R.id;
import it.gcaliendo.elytheme.R.layout;
import it.gcaliendo.elytheme.R.menu;
import it.gcaliendo.elytheme.R.string;

 
public class FragmentContact extends Fragment implements
    Card.CardMenuListener<Card> {
 
  private CardListView list;
  //The below items are the actions attached to the cards, i.e. what the cards will do, if you will not be using a card, you can remove the act  
  private void actGPlus() {
    Uri gplusuriString = Uri.parse(getString(R.string.gplus_link));
    Intent gplusIntent = new Intent("android.intent.action.VIEW",
        gplusuriString);
    try {
      startActivity(gplusIntent);
    } catch (ActivityNotFoundException e2) {
      e2.printStackTrace();
    }
  }

  private void actEmail() {
    Uri emailuriString = Uri.parse(getString(R.string.email_link));
    Intent emailIntent = new Intent("android.intent.action.VIEW",
        emailuriString);
    try {
      startActivity(emailIntent);
    } catch (ActivityNotFoundException e2) {
      e2.printStackTrace();
    }
  }
 
  private void actWeb() {
    Uri weburiString = Uri.parse(getString(R.string.web_link));
    Intent webIntent = new Intent("android.intent.action.VIEW",
        weburiString);
    try {
      startActivity(webIntent);
    } catch (ActivityNotFoundException e2) {
      e2.printStackTrace();
    }
  }
 
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
 
    View view = inflater.inflate(R.layout.fragment_contact, container,
        false);
 
    list = (CardListView) view.findViewById(R.id.ListView);
    list.setOnCardClickListener(new CardClickListener() {
      public void onCardClick(AdapterView<?> adapter, View view,
          int position, long arg) {
 
      }
      //The below section is what tells the card to perform the above action when clicked, make sure to remove the if of any card you are not using
      @Override
      public void onCardClick(int position, CardBase card, View view) {
        String str = card.getTitle().toString();
        if (str.equals(getString(R.string.gplus))) {
          actGPlus();
        }
        if (str.equals(getString(R.string.email))) {
          actEmail();
        }
        if (str.equals(getString(R.string.web))) {
          actWeb();
        }
      }
    });
    return view;
  }
  //The below are the cards to be displayed, if there is a social network you are not going to support, remove the card as well as the act and OnCardClick if statement
  @Override
  public void onStart() {
    super.onStart();
    CardAdapter<Card> cardsAdapter = new CardAdapter<Card>(getActivity(),R.color.card_text)
        .setPopupMenu(R.menu.contact_popup, this);
    cardsAdapter.add(new CardHeader(getActivity(), R.string.socialheader)
        );
    cardsAdapter.add(new Card(getString(R.string.gplus),
        getString(R.string.gplus_extra))
        .setThumbnail(getActivity(), R.drawable.apps_googleplus) // sets a thumbnail image from drawable resources
        .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card
        );
    cardsAdapter.add(new CardHeader(getActivity(), R.string.emailheader));
    cardsAdapter.add(new Card(getString(R.string.email),
        getString(R.string.email_extra))
        .setThumbnail(getActivity(), R.drawable.apps_googlemail) // sets a thumbnail image from drawable resources
        .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card
        ); 
    cardsAdapter.add(new CardHeader(getActivity(), R.string.webheader)
        );
    cardsAdapter.add(new Card(getString(R.string.web),
        getString(R.string.web_extra))
        .setThumbnail(getActivity(), R.drawable.browser) // sets a thumbnail image from drawable resources
        .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card
        ); 

    list.setAdapter(cardsAdapter);
  }
 
  @Override
  public void onMenuItemClick(Card card, MenuItem item) {
    Toast.makeText(getActivity(), card.getTitle() + ": " + item.getTitle(),
        Toast.LENGTH_SHORT).show();
  }
 
}




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