Permalink
Browse files

Merge pull request #412 from BonzaiThePenguin/master

Adding localization support to the ROM scan feature
  • Loading branch information...
littleguy77 committed Feb 24, 2015
2 parents ee3fa7e + b659780 commit 7483584516538ee6771468f09e30ce3eaeadf680
View
@@ -469,6 +469,15 @@
<!-- ROM Scanning -->
<string name="scanning_title">Scanning…</string>
+ <!-- ROM information calculation -->
+ <string name="cacheRomInfo_searching">Searching…</string>
+ <string name="cacheRomInfo_searchingZip">Searching zip file…</string>
+ <string name="cacheRomInfo_computingMD5">Computing MD5…</string>
+ <string name="cacheRomInfo_searchingDB">Searching ROM database…</string>
+ <string name="cacheRomInfo_downloadingArt">Downloading cover art…</string>
+ <string name="cacheRomInfo_refreshingUI">Refreshing UI…</string>
+ <string name="cacheRomInfo_extractingZip">Extracting zip entry…</string>
+
<!-- Seek Bar Preference -->
<string name="seekBarPreference_summary">%1$d %2$s</string>
@@ -555,5 +564,4 @@
<string name="diagnosticActivity_textKey_text">Press button or key…</string>
<string name="diagnosticActivity_textMotion_text">Touch screen or joystick…</string>
-
</resources>
@@ -135,6 +135,18 @@ public void run()
} );
}
+ public void setMessage( final int resid )
+ {
+ mActivity.runOnUiThread( new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ mTextMessage.setText( resid );
+ }
+ } );
+ }
+
public void setMaxProgress( final long size )
{
mActivity.runOnUiThread( new Runnable()
@@ -127,7 +127,7 @@ protected ConfigFile doInBackground( Void... params )
mProgress.setMaxSubprogress( 0 );
mProgress.setSubtext( "" );
mProgress.setText( file.getAbsolutePath().substring( mSearchPath.getAbsolutePath().length() ) );
- mProgress.setMessage( "Searching…" );
+ mProgress.setMessage( R.string.cacheRomInfo_searching );
if( isCancelled() ) break;
RomHeader header = new RomHeader( file );
@@ -147,7 +147,7 @@ else if( header.isZip && mSearchZips )
{
ZipEntry zipEntry = entries.nextElement();
mProgress.setSubtext( zipEntry.getName() );
- mProgress.setMessage( "Searching zip file…" );
+ mProgress.setMessage( R.string.cacheRomInfo_searchingZip );
if( isCancelled() ) break;
try
@@ -228,26 +228,28 @@ protected void onCancelled( ConfigFile result )
private void cacheFile( File file, RomDatabase database, ConfigFile config )
{
if( isCancelled() ) return;
- mProgress.setMessage( "Computing MD5…" );
+ mProgress.setMessage( R.string.cacheRomInfo_computingMD5 );
String md5 = ComputeMd5Task.computeMd5( file );
if( isCancelled() ) return;
- mProgress.setMessage( "Searching ROM database…" );
+ mProgress.setMessage( R.string.cacheRomInfo_searchingDB );
RomDetail detail = database.lookupByMd5WithFallback( md5, file );
String artPath = mArtDir + "/" + detail.artName;
config.put( md5, "goodName", detail.goodName );
+ if (detail.baseName != null && detail.baseName.length() != 0)
+ config.put( md5, "baseName", detail.baseName );
config.put( md5, "romPath", file.getAbsolutePath() );
config.put( md5, "artPath", artPath );
if( mDownloadArt )
{
if( isCancelled() ) return;
- mProgress.setMessage( "Downloading cover art…" );
+ mProgress.setMessage( R.string.cacheRomInfo_downloadingArt );
downloadFile( detail.artUrl, artPath );
}
if( isCancelled() ) return;
- mProgress.setMessage( "Refreshing UI…" );
+ mProgress.setMessage( R.string.cacheRomInfo_refreshingUI );
this.publishProgress( config.get( md5 ) );
}
@@ -275,7 +277,7 @@ private File extractRomFile( File destDir, ZipEntry zipEntry, InputStream inStre
// This entry appears to be a valid ROM, extract it
Log.i( "CacheRomInfoTask", "Found zip entry " + zipEntry.getName() );
- mProgress.setMessage( "Extracting zip entry…" );
+ mProgress.setMessage( R.string.cacheRomInfo_extractingZip );
String entryName = new File( zipEntry.getName() ).getName();
File extractedFile = new File( destDir, entryName );
try

0 comments on commit 7483584

Please sign in to comment.