Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ private boolean isMissingGameData() {
(!fileManager.hasFile("spawn.mpq") || isDownloadingSpawn);
}

public void importData(View view) {
Intent intent = new Intent(this, ImportActivity.class);
startActivity(intent);
}

/**
* Start downloading the shareware
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
public class ImportActivity extends Activity {

private static final int IMPORT_REQUEST_CODE = 0xD1AB70;
private boolean userConfirmed = false;

@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
Expand All @@ -36,12 +37,16 @@ protected void onCreate(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.import_data_info, externalFilesDir));
builder.setPositiveButton(R.string.ok_button, (dialog, which) -> {
this.userConfirmed = true;
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setType("*/*");
startActivityForResult(intent, IMPORT_REQUEST_CODE);
});
builder.setOnDismissListener(dialog -> {
if (!this.userConfirmed && !isFinishing()) finish();
});

AlertDialog dialog = builder.create();
dialog.show();
Expand Down Expand Up @@ -76,6 +81,8 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten

AlertDialog dialog = builder.create();
dialog.show();
} else {
super.onBackPressed();
}
}

Expand Down
38 changes: 31 additions & 7 deletions android-project/app/src/main/res/layout/activity_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,37 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<Button
android:id="@+id/download_button"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/import_buttons"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:onClick="sendDownloadRequest"
android:text="@string/download_spawn"
android:layout_marginEnd="16dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spawn_guide" />
app:layout_constraintTop_toBottomOf="@+id/spawn_guide">

<Button
android:id="@+id/import_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="importData"
android:text="Import Data" />
<Space
android:layout_width="16dp"
android:layout_height="wrap_content" />

<Button
android:id="@+id/download_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="sendDownloadRequest"
android:text="@string/download_spawn" />

</LinearLayout>

<Button
android:id="@+id/check_data_button"
Expand Down Expand Up @@ -98,6 +119,9 @@
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/download_button" />
app:layout_constraintTop_toBottomOf="@+id/import_buttons" />

<android.support.constraint.Group android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</android.support.constraint.ConstraintLayout>
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion android-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.8.0'
classpath 'com.android.tools.build:gradle:8.13.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion android-project/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Apr 29 13:42:12 EEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading