Renamed and reformatted download activity.

This commit is contained in:
Dmitry Yunitsky 2014-07-24 15:36:28 +03:00 committed by Alex Zolotarev
parent 373dff28ea
commit 4a44fe21dd
5 changed files with 42 additions and 43 deletions

View file

@ -108,7 +108,7 @@
</activity>
<activity
android:name="com.mapswithme.country.DownloadUI"
android:name="com.mapswithme.country.DownloadActivity"
android:configChanges="orientation|screenLayout|screenSize"
android:label="@string/download_maps"
android:screenOrientation="behind" >

View file

@ -15,9 +15,9 @@ import com.mapswithme.maps.base.MapsWithMeBaseListActivity;
import com.mapswithme.util.ConnectionState;
public class DownloadUI extends MapsWithMeBaseListActivity implements MapStorage.Listener
public class DownloadActivity extends MapsWithMeBaseListActivity implements MapStorage.Listener
{
static String TAG = "DownloadUI";
static String TAG = DownloadActivity.class.getName();
@Override
protected void onCreate(Bundle savedInstanceState)
@ -29,7 +29,7 @@ public class DownloadUI extends MapsWithMeBaseListActivity implements MapStorage
setListAdapter(new DownloadAdapter(this));
}
private DownloadAdapter getDA()
private DownloadAdapter getDownloadAdapter()
{
return (DownloadAdapter) getListView().getAdapter();
}
@ -38,20 +38,20 @@ public class DownloadUI extends MapsWithMeBaseListActivity implements MapStorage
protected void onResume()
{
super.onResume();
getDA().onResume(this);
getDownloadAdapter().onResume(this);
}
@Override
protected void onPause()
{
super.onPause();
getDA().onPause();
getDownloadAdapter().onPause();
}
@Override
public void onBackPressed()
{
if (getDA().onBackPressed())
if (getDownloadAdapter().onBackPressed())
{
// scroll list view to the top
setSelection(0);
@ -67,13 +67,13 @@ public class DownloadUI extends MapsWithMeBaseListActivity implements MapStorage
@Override
public void onCountryStatusChanged(final Index idx)
{
if (getDA().onCountryStatusChanged(idx) == MapStorage.DOWNLOAD_FAILED)
if (getDownloadAdapter().onCountryStatusChanged(idx) == MapStorage.DOWNLOAD_FAILED)
{
// Show wireless settings page if no connection found.
if (ConnectionState.getState(this) == ConnectionState.NOT_CONNECTED)
{
final DownloadUI activity = this;
final String country = getDA().mStorage.countryName(idx);
final DownloadActivity activity = this;
final String country = getDownloadAdapter().mStorage.countryName(idx);
runOnUiThread(new Runnable()
{
@ -81,35 +81,34 @@ public class DownloadUI extends MapsWithMeBaseListActivity implements MapStorage
public void run()
{
new AlertDialog.Builder(activity)
.setCancelable(false)
.setMessage(String.format(getString(R.string.download_country_failed), country))
.setPositiveButton(getString(R.string.connection_settings), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dlg, int which)
{
try
.setCancelable(false)
.setMessage(String.format(getString(R.string.download_country_failed), country))
.setPositiveButton(getString(R.string.connection_settings), new DialogInterface.OnClickListener()
{
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
}
catch (final Exception ex)
{
Log.e(TAG, "Can't run activity:" + ex);
}
@Override
public void onClick(DialogInterface dlg, int which)
{
try
{
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
} catch (final Exception ex)
{
Log.e(TAG, "Can't run activity:" + ex);
}
dlg.dismiss();
}
})
.setNegativeButton(getString(R.string.close), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dlg, int which)
{
dlg.dismiss();
}
})
.create()
.show();
dlg.dismiss();
}
})
.setNegativeButton(getString(R.string.close), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dlg, int which)
{
dlg.dismiss();
}
})
.create()
.show();
}
});
}
@ -119,6 +118,6 @@ public class DownloadUI extends MapsWithMeBaseListActivity implements MapStorage
@Override
public void onCountryProgress(Index idx, long current, long total)
{
getDA().onCountryProgress(getListView(), idx, current, total);
getDownloadAdapter().onCountryProgress(getListView(), idx, current, total);
}
}

View file

@ -518,7 +518,7 @@ class DownloadAdapter extends BaseAdapter
if (position >= 0 && position < mItems.length)
return position;
else
Log.e(DownloadUI.TAG, "Incorrect item position for: " + idx.toString());
Log.e(DownloadActivity.TAG, "Incorrect item position for: " + idx.toString());
}
return -1;
}

View file

@ -26,7 +26,7 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.mapswithme.country.DownloadUI;
import com.mapswithme.country.DownloadActivity;
import com.mapswithme.maps.Framework.OnBalloonListener;
import com.mapswithme.maps.LocationButtonImageSetter.ButtonState;
import com.mapswithme.maps.MapStorage.Index;
@ -661,7 +661,7 @@ public class MWMActivity extends NvEventQueueActivity
private void runDownloadActivity()
{
startActivity(new Intent(this, DownloadUI.class));
startActivity(new Intent(this, DownloadActivity.class));
}
@Override

View file

@ -7,7 +7,7 @@ import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import com.mapswithme.country.DownloadUI;
import com.mapswithme.country.DownloadActivity;
import com.mapswithme.maps.MWMActivity;
import com.mapswithme.maps.MapStorage.Index;
import com.mapswithme.maps.R;
@ -33,7 +33,7 @@ public class Notifier
final String title = mContext.getString(R.string.advise_update_maps);
// Intent to start DownloadUI
final Intent i = new Intent(mContext, DownloadUI.class);
final Intent i = new Intent(mContext, DownloadActivity.class);
final PendingIntent pi = PendingIntent.getActivity(mContext, 0, i, Intent.FLAG_ACTIVITY_NEW_TASK);
final Notification notification = getBuilder()