mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
include name of dict being downloaded in download progress dialog
This commit is contained in:
parent
f5f54f53f4
commit
f28f5b80d3
3 changed files with 18 additions and 8 deletions
|
@ -13,9 +13,9 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:layout_margin="5sp"
|
||||
/>
|
||||
<TextView android:layout_width="fill_parent"
|
||||
<TextView android:id="@+id/dwnld_message"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/downloading_dict"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -262,8 +262,8 @@
|
|||
<!-- fill this in other than in English -->
|
||||
<string name="xlator"></string>
|
||||
|
||||
<string name="downloading_dict">Downloading Crosswords
|
||||
dictionary...</string>
|
||||
<string name="downloading_dictf">Downloading Crosswords
|
||||
dictionary %s...</string>
|
||||
<string name="no_dict_title">Dictionary not found</string>
|
||||
<string name="button_download">Download</string>
|
||||
<string name="no_dictf">Unable to open game because dictionary %s
|
||||
|
|
|
@ -9,7 +9,9 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.view.Window;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import java.io.InputStream;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
@ -73,6 +75,10 @@ public class DictImportActivity extends Activity {
|
|||
new DownloadFilesTask().execute( uri );
|
||||
} else if ( uri.toString().endsWith( ".xwd" ) ) {
|
||||
Utils.logf( "based on file extn" );
|
||||
String fmt = getString( R.string.downloading_dictf );
|
||||
String txt = String.format( fmt, basename( uri.getPath()) );
|
||||
TextView view = (TextView)findViewById( R.id.dwnld_message );
|
||||
view.setText( txt );
|
||||
new DownloadFilesTask().execute( uri );
|
||||
} else {
|
||||
Utils.logf( "bogus intent: %s/%s", intent.getType(), uri );
|
||||
|
@ -83,16 +89,20 @@ public class DictImportActivity extends Activity {
|
|||
|
||||
private void saveDict( InputStream inputStream, String path )
|
||||
{
|
||||
int slashLoc = path.lastIndexOf('/');
|
||||
String name = path.substring( slashLoc + 1 );
|
||||
try {
|
||||
Utils.saveDict( this, name, inputStream );
|
||||
Utils.saveDict( this, basename(path), inputStream );
|
||||
inputStream.close();
|
||||
} catch ( java.io.IOException ioe ) {
|
||||
Utils.logf( "IOException: %s" + ioe.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String basename( String path )
|
||||
{
|
||||
return new File(path).getName();
|
||||
// int slashLoc = path.lastIndexOf('/');
|
||||
// return path.substring( slashLoc + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue