Merge pull request #8954 from Isira-Seneviratne/Use_Java_8_Date_Time_API
Android: Use Java 8 Date/Time API.
This commit is contained in:
commit
0029ca84b0
|
@ -4,6 +4,9 @@ android {
|
|||
compileSdkVersion 30
|
||||
|
||||
compileOptions {
|
||||
// Flag to enable support for the new language APIs
|
||||
coreLibraryDesugaringEnabled true
|
||||
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
@ -76,6 +79,8 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.1.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
|
|
|
@ -11,12 +11,12 @@ import androidx.fragment.app.FragmentActivity;
|
|||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
public final class StartupHandler
|
||||
{
|
||||
public static final String LAST_CLOSED = "LAST_CLOSED";
|
||||
public static final long SESSION_TIMEOUT = 21600000L; // 6 hours in milliseconds
|
||||
|
||||
public static void HandleInit(FragmentActivity parent)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ public final class StartupHandler
|
|||
{
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor sPrefsEditor = preferences.edit();
|
||||
sPrefsEditor.putLong(LAST_CLOSED, new Date(System.currentTimeMillis()).getTime());
|
||||
sPrefsEditor.putLong(LAST_CLOSED, System.currentTimeMillis());
|
||||
sPrefsEditor.apply();
|
||||
}
|
||||
|
||||
|
@ -70,10 +70,11 @@ public final class StartupHandler
|
|||
*/
|
||||
public static void checkSessionReset(Context context)
|
||||
{
|
||||
long currentTime = new Date(System.currentTimeMillis()).getTime();
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
long lastOpen = preferences.getLong(LAST_CLOSED, 0);
|
||||
if (currentTime > (lastOpen + SESSION_TIMEOUT))
|
||||
final Instant current = Instant.now();
|
||||
final Instant lastOpened = Instant.ofEpochMilli(lastOpen);
|
||||
if (current.isAfter(lastOpened.plus(6, ChronoUnit.HOURS)))
|
||||
{
|
||||
new AfterDirectoryInitializationRunner().run(context, false,
|
||||
NativeLibrary::ReportStartToAnalytics);
|
||||
|
|
|
@ -4,7 +4,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
|
Loading…
Reference in New Issue