@@ -0,0 +1,2017 @@
+/*%0A * Copyright 2015 Adam Speakman%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage speakman.whatsshakingnz;%0A%0Aimport android.content.Context;%0Aimport android.content.SharedPreferences;%0Aimport android.support.annotation.Nullable;%0A%0Aimport org.joda.time.DateTime;%0A%0Aimport speakman.whatsshakingnz.network.RequestTimeStore;%0A%0A/**%0A * Created by Adam on 15-06-07.%0A */%0Apublic class InternalPreferences implements RequestTimeStore %7B%0A%0A    private static final String PREFERENCES_FILENAME = %22speakman.whatsshakingnz.InternalPreferences.PREFERENCES_FILENAME%22;%0A    private static final String KEY_MOST_RECENT_REQUEST_TIME = %22speakman.whatsshakingnz.InternalPreferences.KEY_MOST_RECENT_REQUEST_TIME%22;%0A%0A    private SharedPreferences sharedPrefs;%0A%0A    public InternalPreferences(Context ctx) %7B%0A        sharedPrefs = ctx.getSharedPreferences(PREFERENCES_FILENAME, Context.MODE_PRIVATE);%0A    %7D%0A%0A    @Override%0A    public void saveMostRecentRequestTime(@Nullable DateTime dateTime) %7B%0A        if (dateTime == null) %7B%0A            sharedPrefs.edit().remove(KEY_MOST_RECENT_REQUEST_TIME).apply();%0A        %7D else %7B%0A            sharedPrefs.edit().putLong(KEY_MOST_RECENT_REQUEST_TIME, dateTime.getMillis()).apply();%0A        %7D%0A    %7D%0A%0A    @Nullable%0A    @Override%0A    public DateTime getMostRecentRequestTime() %7B%0A        if (sharedPrefs.contains(KEY_MOST_RECENT_REQUEST_TIME)) %7B%0A            return new DateTime(sharedPrefs.getLong(KEY_MOST_RECENT_REQUEST_TIME, 0));%0A        %7D else %7B%0A            return null;%0A        %7D%0A    %7D%0A%7D%0A

Add internal preferences store