Add keep screen ON.
This commit is contained in:
parent
add3faec6e
commit
c757e860b6
|
|
@ -7,10 +7,10 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.osmdroid.api.IMapController;
|
||||
|
|
@ -18,12 +18,6 @@ import org.osmdroid.config.Configuration;
|
|||
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
|
||||
import org.osmdroid.util.GeoPoint;
|
||||
import org.osmdroid.views.MapView;
|
||||
import org.osmdroid.views.overlay.ItemizedIconOverlay;
|
||||
import org.osmdroid.views.overlay.ItemizedOverlayWithFocus;
|
||||
import org.osmdroid.views.overlay.Overlay;
|
||||
import org.osmdroid.views.overlay.OverlayItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
|
|
@ -75,6 +69,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
//inflate and create the map
|
||||
setContentView(R.layout.main);
|
||||
|
||||
// Keep screen ON
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
map = (MapView) findViewById(R.id.map);
|
||||
map.setTileSource(TileSourceFactory.MAPNIK);
|
||||
|
||||
|
|
@ -95,7 +92,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
//if you make changes to the configuration, use
|
||||
//SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
//Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this));
|
||||
map.onResume(); //needed for compass, my location overlays, v6.0.0 and up
|
||||
if (map != null) {
|
||||
map.onResume(); //needed for compass, my location overlays, v6.0.0 and up
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause(){
|
||||
|
|
@ -104,7 +103,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
//if you make changes to the configuration, use
|
||||
//SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
//Configuration.getInstance().save(this, prefs);
|
||||
map.onPause(); //needed for compass, my location overlays, v6.0.0 and up
|
||||
if (map != null) {
|
||||
map.onPause(); //needed for compass, my location overlays, v6.0.0 and up
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue