Skip to content

Commit

Permalink
✨ Custom path
Browse files Browse the repository at this point in the history
  • Loading branch information
yhs0602 committed Oct 18, 2020
1 parent aef0e2a commit 3472e3c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
Expand Down Expand Up @@ -46,7 +45,9 @@ protected void onCreate(Bundle savedInstanceState) {
lvSongs = (ListView) findViewById(R.id.listViewSongs);
lvSongs.setAdapter(adapter = new SongListViewAdapter(this));

File dir = new File(Environment.getExternalStorageDirectory(), "TempestWave");
String path = getIntent().getStringExtra("path");
// File dir = new File(Environment.getExternalStorageDirectory(), "TempestWave");
File dir = new File(path);
dir = new File(dir, "Songs");
dir.mkdirs();
ArrayList<NoteFile> noteFiles = new ArrayList<>();
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/sma/rhythmtapper/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

private Button _startBtn;
private Button _highscoreBtn;
private Button _aboutBtn;
private EditText _pathEdit;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -20,11 +22,16 @@ protected void onCreate(Bundle savedInstanceState) {
this._startBtn = (Button) this.findViewById(R.id.main_btn_start);
this._highscoreBtn = (Button) this.findViewById(R.id.main_btn_highscore);
this._aboutBtn = (Button) this.findViewById(R.id.main_btn_about);
this._pathEdit = this.findViewById(R.id.etPath);

this._startBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String text = _pathEdit.getText().toString();
if(text.isEmpty())
text= "/sdcard/Android/data/com.nomansland.tempestwave/files/";
Intent i = new Intent(MainActivity.this, DifficultySelectionActivity.class);
i.putExtra("path", text);
MainActivity.this.startActivity(i);
}
});
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="sma.rhythmtapper.MainActivity">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
Expand All @@ -40,5 +37,11 @@
android:layout_height="wrap_content"
android:id="@+id/main_btn_about"
android:text="@string/main_btn_about" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/etPath"
android:text="/sdcard/TempestWave"/>
</LinearLayout>
</RelativeLayout>

0 comments on commit 3472e3c

Please sign in to comment.