fixed usage statistics asking all the time

updated version
This commit is contained in:
Mariotaku Lee 2016-02-08 21:04:11 +08:00
parent c19c37306d
commit 9ea5b7feba
2 changed files with 27 additions and 5 deletions

View File

@ -23,8 +23,8 @@ android {
applicationId "org.mariotaku.twidere" applicationId "org.mariotaku.twidere"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 23 targetSdkVersion 23
versionCode 136 versionCode 137
versionName "3.0.1-SNAPSHOT" versionName "3.0.1"
multiDexEnabled true multiDexEnabled true
buildConfigField 'boolean', 'ENABLE_MEDIA_VIEWER', 'Boolean.parseBoolean("true")' buildConfigField 'boolean', 'ENABLE_MEDIA_VIEWER', 'Boolean.parseBoolean("true")'
@ -118,7 +118,7 @@ dependencies {
compile 'com.github.mariotaku.MediaViewerLibrary:base:0.9.7' compile 'com.github.mariotaku.MediaViewerLibrary:base:0.9.7'
compile 'com.github.mariotaku.MediaViewerLibrary:subsample-image-view:0.9.7' compile 'com.github.mariotaku.MediaViewerLibrary:subsample-image-view:0.9.7'
googleCompile 'com.google.android.gms:play-services-maps:8.4.0' googleCompile 'com.google.android.gms:play-services-maps:8.4.0'
// googleCompile 'com.google.maps.android:android-maps-utils:0.4' googleCompile 'com.google.maps.android:android-maps-utils:0.4'
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true } googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar' googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar'
fdroidCompile 'org.osmdroid:osmdroid-android:5.1' fdroidCompile 'org.osmdroid:osmdroid-android:5.1'

View File

@ -21,15 +21,38 @@ package org.mariotaku.twidere.activity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R; import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.SettingsDetailsFragment; import org.mariotaku.twidere.fragment.SettingsDetailsFragment;
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
import org.mariotaku.twidere.util.dagger.DependencyHolder;
public class UsageStatisticsActivity extends Activity implements Constants { public class UsageStatisticsActivity extends Activity implements Constants {
private static final int REQUEST_USAGE_STATISTICS = 201;
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_USAGE_STATISTICS: {
DependencyHolder holder = DependencyHolder.get(this);
final SharedPreferencesWrapper prefs = holder.getPreferences();
if (!prefs.contains(KEY_USAGE_STATISTICS)) {
final SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(KEY_USAGE_STATISTICS, prefs.getBoolean(KEY_USAGE_STATISTICS));
editor.apply();
}
finish();
return;
}
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -40,8 +63,7 @@ public class UsageStatisticsActivity extends Activity implements Constants {
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsDetailsFragment.class.getName()); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsDetailsFragment.class.getName());
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.usage_statistics); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.usage_statistics);
startActivity(intent); startActivityForResult(intent, REQUEST_USAGE_STATISTICS);
finish();
} }
} }