Reformat files using Android Studio
android-studio/bin/format.sh -m '*.java' -r brouter-routing-app
To rebase active branches on top of the new master just rebase your
branch onto the commit prior to the reformatting and format every commit
of your branch using (<commit> should be replaced by this commit)
git rebase \
--strategy-option=theirs \
--onto <commit> \
--exec 'format.sh -m "*.java" -r brouter-routing-app' \
--exec 'git commit --all --no-edit --amend' \
<commit>~
To ignore this mass edit during git blame see `.git-blame-ignore-revs`
This commit is contained in:
parent
13e0e382c1
commit
54d5c5e943
18 changed files with 3025 additions and 3662 deletions
|
|
@ -22,144 +22,136 @@ import android.util.Log;
|
|||
|
||||
public class BInstallerActivity extends Activity {
|
||||
|
||||
public static final String DOWNLOAD_ACTION = "btools.routingapp.download";
|
||||
public static final String DOWNLOAD_ACTION = "btools.routingapp.download";
|
||||
|
||||
private static final int DIALOG_CONFIRM_DELETE_ID = 1;
|
||||
private static final int DIALOG_CONFIRM_DELETE_ID = 1;
|
||||
|
||||
private BInstallerView mBInstallerView;
|
||||
private PowerManager mPowerManager;
|
||||
private WakeLock mWakeLock;
|
||||
private DownloadReceiver myReceiver;
|
||||
private BInstallerView mBInstallerView;
|
||||
private PowerManager mPowerManager;
|
||||
private WakeLock mWakeLock;
|
||||
private DownloadReceiver myReceiver;
|
||||
|
||||
|
||||
public class DownloadReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.hasExtra("txt")) {
|
||||
String txt = intent.getStringExtra("txt");
|
||||
boolean ready = intent.getBooleanExtra("ready", false);
|
||||
mBInstallerView.setState(txt, ready);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Get an instance of the PowerManager
|
||||
mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||
|
||||
// Create a bright wake lock
|
||||
mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass()
|
||||
.getName());
|
||||
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
|
||||
// instantiate our simulation view and set it as the activity's content
|
||||
mBInstallerView = new BInstallerView(this);
|
||||
setContentView(mBInstallerView);
|
||||
}
|
||||
public class DownloadReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
/*
|
||||
* when the activity is resumed, we acquire a wake-lock so that the
|
||||
* screen stays on, since the user will likely not be fiddling with the
|
||||
* screen or buttons.
|
||||
*/
|
||||
mWakeLock.acquire();
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DOWNLOAD_ACTION);
|
||||
|
||||
myReceiver = new DownloadReceiver();
|
||||
registerReceiver(myReceiver, filter);
|
||||
|
||||
// Start the download manager
|
||||
mBInstallerView.startInstaller();
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.hasExtra("txt")) {
|
||||
String txt = intent.getStringExtra("txt");
|
||||
boolean ready = intent.getBooleanExtra("ready", false);
|
||||
mBInstallerView.setState(txt, ready);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
super.onPause();
|
||||
/**
|
||||
* Called when the activity is first created.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mWakeLock.release();
|
||||
// Get an instance of the PowerManager
|
||||
mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||
|
||||
}
|
||||
// Create a bright wake lock
|
||||
mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass()
|
||||
.getName());
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (myReceiver != null) unregisterReceiver(myReceiver);
|
||||
System.exit(0);
|
||||
}
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
|
||||
// instantiate our simulation view and set it as the activity's content
|
||||
mBInstallerView = new BInstallerView(this);
|
||||
setContentView(mBInstallerView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
/*
|
||||
* when the activity is resumed, we acquire a wake-lock so that the
|
||||
* screen stays on, since the user will likely not be fiddling with the
|
||||
* screen or buttons.
|
||||
*/
|
||||
mWakeLock.acquire();
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DOWNLOAD_ACTION);
|
||||
|
||||
myReceiver = new DownloadReceiver();
|
||||
registerReceiver(myReceiver, filter);
|
||||
|
||||
// Start the download manager
|
||||
mBInstallerView.startInstaller();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
|
||||
super.onPause();
|
||||
|
||||
mWakeLock.release();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (myReceiver != null) unregisterReceiver(myReceiver);
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
AlertDialog.Builder builder;
|
||||
switch ( id )
|
||||
{
|
||||
case DIALOG_CONFIRM_DELETE_ID:
|
||||
builder = new AlertDialog.Builder( this );
|
||||
builder
|
||||
.setTitle( "Confirm Delete" )
|
||||
.setMessage( "Really delete?" ).setPositiveButton( "Yes", new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick( DialogInterface dialog, int id )
|
||||
{
|
||||
mBInstallerView.deleteSelectedTiles();
|
||||
}
|
||||
} ).setNegativeButton( "No", new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick( DialogInterface dialog, int id )
|
||||
{
|
||||
}
|
||||
} );
|
||||
return builder.create();
|
||||
switch (id) {
|
||||
case DIALOG_CONFIRM_DELETE_ID:
|
||||
builder = new AlertDialog.Builder(this);
|
||||
builder
|
||||
.setTitle("Confirm Delete")
|
||||
.setMessage("Really delete?").setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
mBInstallerView.deleteSelectedTiles();
|
||||
}
|
||||
}).setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
|
||||
default:
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void showConfirmDelete()
|
||||
{
|
||||
showDialog( DIALOG_CONFIRM_DELETE_ID );
|
||||
public void showConfirmDelete() {
|
||||
showDialog(DIALOG_CONFIRM_DELETE_ID);
|
||||
}
|
||||
|
||||
private Set<Integer> dialogIds = new HashSet<Integer>();
|
||||
|
||||
private void showNewDialog( int id )
|
||||
{
|
||||
if ( dialogIds.contains( Integer.valueOf( id ) ) )
|
||||
{
|
||||
removeDialog( id );
|
||||
private void showNewDialog(int id) {
|
||||
if (dialogIds.contains(Integer.valueOf(id))) {
|
||||
removeDialog(id);
|
||||
}
|
||||
dialogIds.add( Integer.valueOf( id ) );
|
||||
showDialog( id );
|
||||
dialogIds.add(Integer.valueOf(id));
|
||||
showDialog(id);
|
||||
}
|
||||
|
||||
|
||||
static public long getAvailableSpace (String baseDir) {
|
||||
static public long getAvailableSpace(String baseDir) {
|
||||
StatFs stat = new StatFs(baseDir);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
return stat.getAvailableBlocksLong()*stat.getBlockSizeLong();
|
||||
}
|
||||
else {
|
||||
return stat.getAvailableBlocks()*stat.getBlockSize();
|
||||
return stat.getAvailableBlocksLong() * stat.getBlockSizeLong();
|
||||
} else {
|
||||
return stat.getAvailableBlocks() * stat.getBlockSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue