Android Open Source - PlanningPokerPlusPlus Startup






From Project

Back to project page PlanningPokerPlusPlus.

License

The source code is released under:

Planning Poker++ for Android, copyright (c) 2011-2014 Richard Everett No specific license, but please don't rip off this codebase for use in your own similar app.

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

// Planning Poker++ for Android, copyright (c) Richard Everett 2012
// Full source available on GitHub at http://richev.github.com/PlanningPokerPlusPlus
// w  w  w.j  a v a  2 s  .c  o m
package com.richev.planningpokerplusplus;

import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceManager;

/**
 * Useful application startup-related items
 * @author Rich
 *
 */
public class Startup
{
    private Activity _activity;
    
    public Startup(Activity activity)
    {
        _activity = activity;
    }
    
    /**
     * Whether this version of this application is being run on this device for the first time
     * @return
     */
    public Boolean getHasRun()
    {
        return PreferenceManager.getDefaultSharedPreferences(_activity).getBoolean("hasRun" + getVersionCode(), false);
    }
    
    /**
     * Sets that this version of this application has been run on this device
     */
    public void setHasRun()
    {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_activity);
        Editor editor = prefs.edit();
        editor.putBoolean("hasRun" + getVersionCode(), true);
        editor.commit();
    }

    private int getVersionCode()
    {
        int versionCode = 0;
        
        try
        {
            versionCode = _activity.getPackageManager().getPackageInfo(
                    _activity.getApplicationInfo().packageName, 0).versionCode;
        }
        catch (NameNotFoundException ex)
        {
            // Required otherwise the compiler complains
        }

        return versionCode;
    } 
}




Java Source Code List

com.richev.planningpokerplusplus.AboutActivity.java
com.richev.planningpokerplusplus.CardActivity.java
com.richev.planningpokerplusplus.MainActivity.java
com.richev.planningpokerplusplus.MenuedActivity.java
com.richev.planningpokerplusplus.OnCardSelectListener.java
com.richev.planningpokerplusplus.Preferences.java
com.richev.planningpokerplusplus.SettingsActivity.java
com.richev.planningpokerplusplus.Startup.java
com.richev.planningpokerplusplus.UpsideDownImageView.java
com.richev.planningpokerplusplus.UpsideDownTextView.java
com.richev.planningpokerplusplus.Utils.java