Implemented write perms requesting for each file session
This commit is contained in:
@@ -76,6 +76,15 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
public void openDonations() {
|
public void openDonations() {
|
||||||
showDonations();
|
showDonations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestWritePerms() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_REQUEST_CODE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(doubleScaleTablets && isTablet(this.getContext())){
|
if(doubleScaleTablets && isTablet(this.getContext())){
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class Mindustry extends ModuleCore {
|
|||||||
@Override public void onSceneChange(String state, String details, String icon) {}
|
@Override public void onSceneChange(String state, String details, String icon) {}
|
||||||
@Override public void onGameExit() {}
|
@Override public void onGameExit() {}
|
||||||
@Override public void openDonations() {}
|
@Override public void openDonations() {}
|
||||||
|
@Override public void requestWritePerms() {}
|
||||||
};
|
};
|
||||||
public static OrderedMap<String, Integer> idMap = new OrderedMap<>();
|
public static OrderedMap<String, Integer> idMap = new OrderedMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ public interface PlatformFunction{
|
|||||||
public void onSceneChange(String state, String details, String icon);
|
public void onSceneChange(String state, String details, String icon);
|
||||||
public void onGameExit();
|
public void onGameExit();
|
||||||
public void openDonations();
|
public void openDonations();
|
||||||
|
public void requestWritePerms();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,25 +6,17 @@ import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
|||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.Pools;
|
import com.badlogic.gdx.utils.Pools;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import io.anuke.mindustry.Mindustry;
|
import io.anuke.mindustry.Mindustry;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.function.Predicate;
|
import io.anuke.ucore.function.Predicate;
|
||||||
import io.anuke.ucore.scene.event.Touchable;
|
import io.anuke.ucore.scene.event.Touchable;
|
||||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
|
||||||
import io.anuke.ucore.scene.ui.Image;
|
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
|
||||||
import io.anuke.ucore.scene.ui.Label;
|
|
||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class FileChooser extends FloatingDialog{
|
public class FileChooser extends FloatingDialog{
|
||||||
private Table files;
|
private Table files;
|
||||||
private FileHandle homeDirectory = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
|
private FileHandle homeDirectory = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
|
||||||
@@ -47,6 +39,10 @@ public class FileChooser extends FloatingDialog{
|
|||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.selectListener = result;
|
this.selectListener = result;
|
||||||
setupWidgets();
|
setupWidgets();
|
||||||
|
|
||||||
|
if(!open){
|
||||||
|
Mindustry.platforms.requestWritePerms();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupWidgets(){
|
private void setupWidgets(){
|
||||||
|
|||||||
@@ -60,11 +60,9 @@ public class DesktopLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void addDialog(TextField field){}
|
||||||
public void addDialog(TextField field){}
|
@Override public void openDonations(){}
|
||||||
|
@Override public void requestWritePerms() {}
|
||||||
@Override
|
|
||||||
public void openDonations(){}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSceneChange(String state, String details, String icon) {
|
public void onSceneChange(String state, String details, String icon) {
|
||||||
|
|||||||
@@ -110,17 +110,11 @@ public class HtmlLauncher extends GwtApplication {
|
|||||||
Window.open(link, "_blank", "");
|
Window.open(link, "_blank", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void onSceneChange(String state, String details, String icon) {}
|
||||||
public void addDialog(TextField field){}
|
@Override public void onGameExit() {}
|
||||||
|
@Override public void addDialog(TextField field){}
|
||||||
@Override
|
@Override public void openDonations(){}
|
||||||
public void onSceneChange(String state, String details, String icon) {}
|
@Override public void requestWritePerms() {}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGameExit() {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openDonations() {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return new Mindustry();
|
return new Mindustry();
|
||||||
|
|||||||
Reference in New Issue
Block a user