Skip to content
Permalink
Browse files

Merge pull request #501 from fzurita/cheat_title_not_refreshing

Speed up clearing of selected cheats after cheats are modified
  • Loading branch information
Gillou68310
Gillou68310 committed Oct 28, 2015
2 parents fc1ff15 + 28d1251 commit 3d48a0f0d3aaa42f02755f72e2defa28988c8d73
Showing with 24 additions and 11 deletions.
  1. +24 −11 src/paulscode/android/mupen64plusae/persistent/GamePrefsActivity.java
@@ -22,9 +22,7 @@

import java.io.File;
import java.util.ArrayList;

import org.mupen64plusae.v3.alpha.R;

import paulscode.android.mupen64plusae.ActivityHelper;
import paulscode.android.mupen64plusae.cheat.CheatEditorActivity;
import paulscode.android.mupen64plusae.cheat.CheatPreference;
@@ -41,19 +39,21 @@
import paulscode.android.mupen64plusae.util.RomDatabase;
import paulscode.android.mupen64plusae.util.RomDatabase.RomDetail;
import paulscode.android.mupen64plusae.util.RomHeader;
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.text.TextUtils;

import com.bda.controller.Controller;


public class GamePrefsActivity extends AppCompatPreferenceActivity implements OnPreferenceClickListener,
OnSharedPreferenceChangeListener, ExtractCheatListener
{
@@ -316,6 +316,7 @@ private void refreshCheatsCategory()
}
}

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onExtractFinished(ArrayList<Cheat> cheats)
{
@@ -350,21 +351,33 @@ public void onExtractFinished(ArrayList<Cheat> cheats)
//We store the cheat index in the key as a string
String key = mRomCrc + " Cheat" + cheat.cheatIndex ;
pref.setKey( key );

// Add the preference menu item to the cheats category
mCategoryCheats.addPreference( pref );

//We reset if the list was changed by the user
if(mClearCheats)
// We reset if the list was changed by the user
if (mClearCheats)
{
mPrefs.edit().putInt( key, 0 ).commit();
pref.onOptionChoice(0);
}

// Add the preference menu item to the cheats category
mCategoryCheats.addPreference( pref );
}

mScreenCheats.addPreference( mCategoryCheats );

//Reset this to false if it was set
mClearCheats = false;
if(mClearCheats)
{
//Reset this to false if it was set
if (AppData.IS_GINGERBREAD)
{
mPrefs.edit().apply();
}
else
{
mPrefs.edit().commit();
}

mClearCheats = false;
}
}

@Override

0 comments on commit 3d48a0f

Please sign in to comment.
You can’t perform that action at this time.