Android Open Source - notes About Dialog






From Project

Back to project page notes.

License

The source code is released under:

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or...

If you think the Android project notes 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 com.iliakplv.notes.gui.main.dialogs;
/*w w  w.  ja  va 2 s .c om*/
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.util.Linkify;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.iliakplv.notes.R;
import com.iliakplv.notes.utils.Utils;

public class AboutDialog extends DialogFragment {
  private static final String FRAGMENT_TAG = AboutDialog.class.getSimpleName();

  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    return new AlertDialog.Builder(getActivity())
        .setTitle(R.string.app_name)
        .setView(createView())
        .setNegativeButton(R.string.common_close, null)
        .create();
  }

  public View createView() {
    final Context context = getActivity();
    final LayoutInflater inflater = getActivity().getLayoutInflater();
    final View view = inflater.inflate(R.layout.about_dialog, null);

    // version
    final String appVersion = Utils.getVersionName();
    ((TextView) view.findViewById(R.id.version))
        .setText(context.getString(R.string.about_version, appVersion));

    // google play
    view.findViewById(R.id.google_play).setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        openGooglePlay();
      }
    });


    // email
    view.findViewById(R.id.contact).setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        sendFeedback();
      }
    });

    // sources
    final TextView sourcesInfo = (TextView) view.findViewById(R.id.sources);
    Linkify.addLinks(sourcesInfo, Linkify.WEB_URLS);

    return view;
  }

  private void openGooglePlay() {
    final Intent browserIntent = new Intent(Intent.ACTION_VIEW,
        Uri.parse("https://play.google.com/store/apps/details?id=" + getActivity().getPackageName()));
    startActivity(browserIntent);
  }

  private void sendFeedback() {
    final Context context = getActivity();
    final Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
        Uri.fromParts("mailto", "iliakplv@gmail.com", null));
    final String subject = context.getString(R.string.app_name) + " feedback";
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(Intent.EXTRA_TEXT, getTextForFeedback(context));
    startActivity(Intent.createChooser(emailIntent, context.getString(R.string.about_contact)));
  }

  private String getTextForFeedback(Context context) {
    return context.getString(R.string.about_contact_do_not_remove) + Utils.getDeviceInformation();
  }

  public static void show(FragmentManager fm) {
    final AboutDialog dialog = new AboutDialog();
    dialog.show(fm, FRAGMENT_TAG);
  }
}




Java Source Code List

com.iliakplv.notes.NotesApplication.java
com.iliakplv.notes.analytics.EventTracker.java
com.iliakplv.notes.analytics.Event.java
com.iliakplv.notes.gui.main.MainActivityTest.java
com.iliakplv.notes.gui.main.MainActivity.java
com.iliakplv.notes.gui.main.NavigationDrawerFragment.java
com.iliakplv.notes.gui.main.NoteDetailsFragment.java
com.iliakplv.notes.gui.main.NotesListFragment.java
com.iliakplv.notes.gui.main.dialogs.AboutDialog.java
com.iliakplv.notes.gui.main.dialogs.AbstractItemDialog.java
com.iliakplv.notes.gui.main.dialogs.DropboxAccountLinkingDialog.java
com.iliakplv.notes.gui.main.dialogs.LabelEditDialog.java
com.iliakplv.notes.gui.main.dialogs.NoteLabelsDialog.java
com.iliakplv.notes.gui.main.dialogs.SimpleItemDialog.java
com.iliakplv.notes.gui.main.dialogs.VoiceSearchInstallDialog.java
com.iliakplv.notes.gui.settings.SettingsActivity.java
com.iliakplv.notes.notes.AbstractNote.java
com.iliakplv.notes.notes.LabelComparator.java
com.iliakplv.notes.notes.Label.java
com.iliakplv.notes.notes.NoteComparator.java
com.iliakplv.notes.notes.NotesUtils.java
com.iliakplv.notes.notes.TextNote.java
com.iliakplv.notes.notes.db.NotesDatabaseAdapter.java
com.iliakplv.notes.notes.db.NotesDatabaseOpenHelper.java
com.iliakplv.notes.notes.db.NotesDatabaseStorage.java
com.iliakplv.notes.notes.dropbox.DropboxHelper.java
com.iliakplv.notes.notes.dropbox.NotesDropboxStorage.java
com.iliakplv.notes.notes.storage.NotesStorageListener.java
com.iliakplv.notes.notes.storage.NotesStorage.java
com.iliakplv.notes.notes.storage.StorageDataTransfer.java
com.iliakplv.notes.notes.storage.StorageWrapper.java
com.iliakplv.notes.notes.storage.Storage.java
com.iliakplv.notes.storage.StorageTest.java
com.iliakplv.notes.utils.AppLog.java
com.iliakplv.notes.utils.ConnectivityUtils.java
com.iliakplv.notes.utils.StringUtils.java
com.iliakplv.notes.utils.Utils.java