Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    /**
     * SharedPreferences tags
     */

    //We would need migration code to update NAME and MASQUERADED_USER to snake case, so we will leave them as is for now.
    private final static String SHARED_PREFERENCES_NAME = "canvas-kit-sp";
    private final static String SHARED_PREFERENCES_DISMISSED_NETWORK_ERROR = "dismissed_network_error";

    /**
     * Check to see if the user has seen the network error message so we don't need to display it repeatedly
     * @param context
     * @return True if the user has seen the network error message, false otherwise
     */
    public static boolean hasSeenNetworkErrorMessage(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME,
                Context.MODE_PRIVATE);

        return sharedPreferences.getBoolean(SHARED_PREFERENCES_DISMISSED_NETWORK_ERROR, false);
    }
}