diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index d1d2e5c..2e6a50e 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -11,11 +11,25 @@ + diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 55ceb75..d5b72e2 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/build.gradle b/app/build.gradle index 3041454..e0df892 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "ca.pkay.rcloneexplorer" minSdkVersion 21 targetSdkVersion 27 - versionCode 1 - versionName "1.0" + versionCode 2 + versionName "0.2.0-alpha" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { @@ -28,14 +28,15 @@ dependencies { implementation "com.android.support:support-compat:27.1.0" implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:design:27.1.0' - implementation 'com.afollestad.material-dialogs:core:0.9.6.0' // https://github.com/afollestad/material-dialogs + implementation 'com.afollestad.material-dialogs:core:0.9.6.0' implementation 'yogesh.firzen:MukkiyaSevaigal:1.0.6' - implementation "com.leinardi.android:speed-dial:1.0-alpha03" // https://github.com/leinardi/FloatingActionButtonSpeedDial - implementation 'com.shehabic.droppy:Droppy:0.6.0@aar' // https://github.com/shehabic/Droppy - implementation 'ru.bartwell:exfilepicker:2.4' // https://github.com/bartwell/ExFilePicker + implementation "com.leinardi.android:speed-dial:1.0-alpha03" + implementation 'com.shehabic.droppy:Droppy:0.6.0@aar' + implementation 'ru.bartwell:exfilepicker:2.4' implementation "com.mikepenz:iconics-core:3.0.3@aar" implementation 'com.mikepenz:community-material-typeface:2.0.46.1@aar' implementation 'com.mikepenz:fontawesome-typeface:5.0.6.0@aar' + implementation "com.mikepenz:aboutlibraries:6.0.8" testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index af04b5c..dedfd5c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,6 +22,7 @@ + @@ -37,7 +38,13 @@ android:grantUriPermissions="true"> + android:resource="@xml/file_provider_paths" /> + + + \ No newline at end of file diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/AboutActivity.java b/app/src/main/java/ca/pkay/rcloneexplorer/AboutActivity.java new file mode 100644 index 0000000..2d52e78 --- /dev/null +++ b/app/src/main/java/ca/pkay/rcloneexplorer/AboutActivity.java @@ -0,0 +1,103 @@ +package ca.pkay.rcloneexplorer; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.widget.TextView; +import android.widget.Toast; + +import com.mikepenz.aboutlibraries.Libs; +import com.mikepenz.aboutlibraries.LibsBuilder; + +public class AboutActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about); + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayShowHomeEnabled(true); + } + + Rclone rclone = new Rclone(this); + + ((TextView)findViewById(R.id.version_number)).setText(BuildConfig.VERSION_NAME); + ((TextView)findViewById(R.id.rclone_version)).setText(rclone.getRcloneVersion()); + + findViewById(R.id.changelog).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showChangelog(); + } + }); + findViewById(R.id.open_source_libraries).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showOpenSourceLibraries(); + } + }); + findViewById(R.id.star_on_github).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + openAppGitHubLink(); + } + }); + findViewById(R.id.report_bug).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + reportBug(); + } + }); + findViewById(R.id.author_github_link).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + openAuthorGitHubLink(); + } + }); + } + + @Override + public boolean onSupportNavigateUp() { + onBackPressed(); + return true; + } + + private void showChangelog() { + Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show(); + } + + private void showOpenSourceLibraries() { + new LibsBuilder() + .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR) + .withActivityTitle("Credits/Libraries") + .withAutoDetect(false) + .withLibraries() + .withExcludedLibraries() + .start(this); + } + + private void openAppGitHubLink() { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/kaczmarkiewiczp/rcloneExplorer")); + startActivity(browserIntent); + } + + private void reportBug() { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/kaczmarkiewiczp/rcloneExplorer/issues/new")); + startActivity(browserIntent); + } + + private void openAuthorGitHubLink() { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/kaczmarkiewiczp")); + startActivity(browserIntent); + } +} diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/MainActivity.java b/app/src/main/java/ca/pkay/rcloneexplorer/MainActivity.java index 8a404e5..0419ef9 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/MainActivity.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/MainActivity.java @@ -57,17 +57,6 @@ protected void onCreate(Bundle savedInstanceState) { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); - /* - FloatingActionButton fab = findViewById(R.id.fab); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) - .setAction("Action", null).show(); - } - }); - */ - DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); @@ -137,14 +126,21 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); - if (id == R.id.nav_remotes) { - startRemotesFragment(); - } else if (id == R.id.nav_import) { - if (rclone.isConfigFileCreated()) { - warnUserAboutOverwritingConfiguration(); - } else { - importConfigFile(); - } + switch (id) { + case R.id.nav_remotes: + startRemotesFragment(); + break; + case R.id.nav_import: + if (rclone.isConfigFileCreated()) { + warnUserAboutOverwritingConfiguration(); + } else { + importConfigFile(); + } + break; + case R.id.nav_about: + Intent aboutIntent = new Intent(this, AboutActivity.class); + startActivity(aboutIntent); + break; } DrawerLayout drawer = findViewById(R.id.drawer_layout); diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java b/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java index 08c8126..41db9c6 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java @@ -304,6 +304,31 @@ public void moveTo(String remote, String oldFile, String newFile) { } } + public String getRcloneVersion() { + String[] command = createCommand("--version"); + ArrayList result = new ArrayList<>(); + try { + Process process = Runtime.getRuntime().exec(command); + process.waitFor(); + if (process.exitValue() != 0) { + // TODO report error + return "-1"; + } + + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) { + result.add(line); + } + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + return "-1"; + } + + String[] version = result.get(0).split("\\s+"); + return version[1]; + } + public boolean isConfigFileCreated() { String appsFileDir = activity.getFilesDir().getPath(); String configFile = appsFileDir + "/rclone.conf"; diff --git a/app/src/main/res/drawable/ic_about.xml b/app/src/main/res/drawable/ic_about.xml new file mode 100644 index 0000000..cc94088 --- /dev/null +++ b/app/src/main/res/drawable/ic_about.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_bug_report.xml b/app/src/main/res/drawable/ic_bug_report.xml new file mode 100644 index 0000000..4d83902 --- /dev/null +++ b/app/src/main/res/drawable/ic_bug_report.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_changelog.xml b/app/src/main/res/drawable/ic_changelog.xml new file mode 100644 index 0000000..a61de1b --- /dev/null +++ b/app/src/main/res/drawable/ic_changelog.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_info_outline.xml b/app/src/main/res/drawable/ic_info_outline.xml new file mode 100644 index 0000000..cf53e14 --- /dev/null +++ b/app/src/main/res/drawable/ic_info_outline.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_libraries.xml b/app/src/main/res/drawable/ic_libraries.xml new file mode 100644 index 0000000..a51097e --- /dev/null +++ b/app/src/main/res/drawable/ic_libraries.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_mark_github.xml b/app/src/main/res/drawable/ic_mark_github.xml new file mode 100644 index 0000000..0bed7b5 --- /dev/null +++ b/app/src/main/res/drawable/ic_mark_github.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_person_outline.xml b/app/src/main/res/drawable/ic_person_outline.xml new file mode 100644 index 0000000..f182b8d --- /dev/null +++ b/app/src/main/res/drawable/ic_person_outline.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml new file mode 100644 index 0000000..d77d931 --- /dev/null +++ b/app/src/main/res/layout/activity_about.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/content_about.xml b/app/src/main/res/layout/content_about.xml new file mode 100644 index 0000000..ddb98b8 --- /dev/null +++ b/app/src/main/res/layout/content_about.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml index 2d31878..711d140 100644 --- a/app/src/main/res/layout/nav_header_main.xml +++ b/app/src/main/res/layout/nav_header_main.xml @@ -26,10 +26,4 @@ android:text="Rclone Explorer" android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> - - diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index 514af6b..8e81fbf 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -21,5 +21,11 @@ android:id="@+id/nav_import" android:icon="@drawable/ic_import" android:title="Import rclone config" /> + + diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml index 6cdb770..ab7e6e5 100644 --- a/app/src/main/res/values-v27/styles.xml +++ b/app/src/main/res/values-v27/styles.xml @@ -3,7 +3,7 @@ diff --git a/app/src/main/res/values/about_libraries_droppy.xml b/app/src/main/res/values/about_libraries_droppy.xml new file mode 100644 index 0000000..335a268 --- /dev/null +++ b/app/src/main/res/values/about_libraries_droppy.xml @@ -0,0 +1,13 @@ + + + + Mohamed Shehab + https://github.com/shehabic/ + Droppy + A simple yet-powerful and fully customizable Android drop-down menu. It supports Text with/without Icons, Separators, and even fully customized views. + + https://github.com/shehabic/Droppy/ + apache_2_0 + true + https://github.com/shehabic/Droppy/ + \ No newline at end of file diff --git a/app/src/main/res/values/about_libraries_exfile_picker.xml b/app/src/main/res/values/about_libraries_exfile_picker.xml new file mode 100644 index 0000000..2af1458 --- /dev/null +++ b/app/src/main/res/values/about_libraries_exfile_picker.xml @@ -0,0 +1,13 @@ + + + + Artem Bazhanov + https://github.com/bartwell/ + ExFile Picker + Open source Android library. Implement choosing files and directories in your application. + + https://github.com/bartwell/ExFilePicker/ + MIT + true + https://github.com/bartwell/ExFilePicker/ + \ No newline at end of file diff --git a/app/src/main/res/values/about_libraries_floating_action_button_speed_dial.xml b/app/src/main/res/values/about_libraries_floating_action_button_speed_dial.xml new file mode 100644 index 0000000..ad6dc19 --- /dev/null +++ b/app/src/main/res/values/about_libraries_floating_action_button_speed_dial.xml @@ -0,0 +1,13 @@ + + + + Roberto Leinardi + https://github.com/leinardi/ + Floating Action Button Speed Dial + A Floating Action Button Speed Dial implementation for Android that follows the Material Design specification + + https://github.com/leinardi/FloatingActionButtonSpeedDial/ + apache_2_0 + true + https://github.com/leinardi/FloatingActionButtonSpeedDial/ + \ No newline at end of file diff --git a/app/src/main/res/values/about_libraries_game_building_tools.xml b/app/src/main/res/values/about_libraries_game_building_tools.xml new file mode 100644 index 0000000..5ecdbaa --- /dev/null +++ b/app/src/main/res/values/about_libraries_game_building_tools.xml @@ -0,0 +1,13 @@ + + + + Game Building Tools + http://www.gamebuildingtools.com/ + Game Building Tools + GameBuildingTools.com was built by a game developer for the community. Grab graphics, audio, and more for your next project. + + http://www.gamebuildingtools.com/product/desert-parallax-background/ + Attribution 4.0 International (CC BY 4.0) + true + http://www.gamebuildingtools.com/product/desert-parallax-background/ + \ No newline at end of file diff --git a/app/src/main/res/values/about_libraries_icon.xml b/app/src/main/res/values/about_libraries_icon.xml new file mode 100644 index 0000000..e5ab826 --- /dev/null +++ b/app/src/main/res/values/about_libraries_icon.xml @@ -0,0 +1,13 @@ + + + + Icon 54 + https://thenounproject.com/icon54app/ + Sync Cloud Icon + App icon created by Icon 54 from the Noun Project + + https://thenounproject.com/term/sync-cloud/209817/ + Creative Commons CCBY + true + https://thenounproject.com/term/sync-cloud/209817/ + \ No newline at end of file diff --git a/app/src/main/res/values/about_libraries_material_dialogs.xml b/app/src/main/res/values/about_libraries_material_dialogs.xml new file mode 100644 index 0000000..9e24303 --- /dev/null +++ b/app/src/main/res/values/about_libraries_material_dialogs.xml @@ -0,0 +1,13 @@ + + + + Aidan Follestad + https://aidanfollestad.com/ + Material Dialogs + A beautiful, fluid, and customizable dialogs API. + + https://github.com/afollestad/material-dialogs/ + MIT + true + https://github.com/afollestad/material-dialogs/ + \ No newline at end of file diff --git a/app/src/main/res/values/about_libraries_rclone.xml b/app/src/main/res/values/about_libraries_rclone.xml new file mode 100644 index 0000000..7a6f67e --- /dev/null +++ b/app/src/main/res/values/about_libraries_rclone.xml @@ -0,0 +1,13 @@ + + + + Nick Craig-Wood + https://www.craig-wood.com/nick/ + rclone + "rsync for cloud storage" - Google Drive, Amazon Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Cloudfiles, Google Cloud Storage, Yandex Files + + https://rclone.org/ + MIT + true + https://github.com/ncw/rclone/ + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 70d85d5..409b882 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,4 +6,5 @@ Close navigation drawer Settings + About