Android Open Source - HomeMovies Share Dialog






From Project

Back to project page HomeMovies.

License

The source code is released under:

MIT License

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

package il.co.All4Students.homemovies.util.dialog;
/* w ww . ja  va  2s. c o  m*/
import il.co.All4Students.homemovies.R;
import il.co.All4Students.homemovies.app.ApplicationPreference;
import il.co.All4Students.homemovies.core.Item;
import il.co.All4Students.homemovies.util.email.EmailUtil;
import il.co.All4Students.homemovies.util.json.JSONHandler;

import java.util.ArrayList;

import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

/**
 * ShareDialog The class handles the alert dialog foe the diffrent Share options
 * that the App implements
 * 
 * Curentlly: - Email
 * 
 * in Prograsse: - FaceBook - Tweeter
 * 
 * @author Arkadi Yoskovitz
 * @date 2013-02-08
 */

public class ShareDialog {
  // Attributes
  private ApplicationPreference mSettings;
  private Context mContext;
  private Item mItem;

  // Constractors
  public ShareDialog(Item item, Context context) {
    super();
    this.mItem = item;
    this.mContext = context;
  }

  // Additional Methods
  public void showShareDialog() {
    LayoutInflater li = LayoutInflater.from(mContext);

    View ShareDialogView = li.inflate(R.layout.custom_dialog_share, null);

    AlertDialog.Builder shareDialog = new AlertDialog.Builder(mContext);
    shareDialog.setView(ShareDialogView);
    shareDialog.setTitle(mContext.getResources().getString(
        R.string.ShareDialogTitle));
    shareDialog.setIcon(mContext.getResources().getDrawable(
        R.drawable.ic_dialog_share));
    shareDialog.create();
    // Showing Alert Message
    final AlertDialog SDialog = shareDialog.show();

    View btnEmail = ShareDialogView
        .findViewById(R.id.customDialogShareButtonAirMail);
    btnEmail.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        mSettings = new ApplicationPreference(mContext);

        String emailToAddress = "";
        String emailCCAddress = mSettings.getEmail().toString();
        String emailSubject = mItem.getSubject();
        String emailText = mItem.getBody() + "\n\n\n"
            + mItem.getUrlWeb();
        ArrayList<String> emailFilePaths = JSONHandler
            .getURIFromJSON(mItem.getUrlLocal());

        EmailUtil.sendEmail(mContext, emailToAddress, emailCCAddress,
            emailSubject, emailText, emailFilePaths);
        SDialog.dismiss();
      }
    });

    View btnFaceBook = ShareDialogView
        .findViewById(R.id.customDialogShareButtonFaceBook);
    btnFaceBook.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        Toast.makeText(mContext, "FaceBook is unavlible at this time",
            Toast.LENGTH_SHORT).show();
        SDialog.dismiss();
      }
    });

    View btnTweeter = ShareDialogView
        .findViewById(R.id.customDialogShareButtonTweeter);
    btnTweeter.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        Toast.makeText(mContext, "Tweeter is unavlible at this time",
            Toast.LENGTH_SHORT).show();
        SDialog.dismiss();
      }
    });

  }
}




Java Source Code List

il.co.All4Students.homemovies.OkCancelBar.java
il.co.All4Students.homemovies.ScreenEdit.java
il.co.All4Students.homemovies.ScreenGridDetail.java
il.co.All4Students.homemovies.ScreenGrid.java
il.co.All4Students.homemovies.ScreenMain.java
il.co.All4Students.homemovies.ScreenPreferences.java
il.co.All4Students.homemovies.ScreenWeb.java
il.co.All4Students.homemovies.app.AppConstants.java
il.co.All4Students.homemovies.app.ApplicationPreference.java
il.co.All4Students.homemovies.app.HomeProjectApplication.java
il.co.All4Students.homemovies.core.ItemCompareRTID.java
il.co.All4Students.homemovies.core.ItemCompareRank.java
il.co.All4Students.homemovies.core.ItemCompareSubject.java
il.co.All4Students.homemovies.core.Item.java
il.co.All4Students.homemovies.util.adapter.ItemListAdapter.java
il.co.All4Students.homemovies.util.adapter.ScreenGridAdapter.java
il.co.All4Students.homemovies.util.app.AppUtil.java
il.co.All4Students.homemovies.util.db.ItemsDbConstants.java
il.co.All4Students.homemovies.util.db.ItemsDbHelper.java
il.co.All4Students.homemovies.util.db.ItemsHandler.java
il.co.All4Students.homemovies.util.dialog.RankDialog.java
il.co.All4Students.homemovies.util.dialog.ShareDialog.java
il.co.All4Students.homemovies.util.email.EmailUtil.java
il.co.All4Students.homemovies.util.image.ExternalStorageLoader.java
il.co.All4Students.homemovies.util.imageWeb.FileCache.java
il.co.All4Students.homemovies.util.imageWeb.ImageLoader.java
il.co.All4Students.homemovies.util.imageWeb.MemoryCache.java
il.co.All4Students.homemovies.util.json.JSONHandler.java
il.co.All4Students.homemovies.util.json.JSONUtilWithTags.java
il.co.All4Students.homemovies.util.json.JSONUtil.java
il.co.All4Students.homemovies.util.log.db.LogDbConstants.java
il.co.All4Students.homemovies.util.log.db.LogDbHelper.java
il.co.All4Students.homemovies.util.log.db.LogHandler.java
il.co.All4Students.homemovies.util.log.util.AppLog.java