Skip to content

Commit

Permalink
Merge pull request #43 from kaczmarkiewiczp/dev
Browse files Browse the repository at this point in the history
Add about screen
  • Loading branch information
patrykcoding authored Apr 17, 2018
2 parents 4b67325 + 522cb1d commit 8427ae6
Show file tree
Hide file tree
Showing 27 changed files with 622 additions and 36 deletions.
20 changes: 17 additions & 3 deletions .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
13 changes: 7 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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'
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service android:name=".Services.DownloadService" />
<service android:name=".Services.UploadService" />
<service android:name=".Services.StreamingService" />
Expand All @@ -37,7 +38,13 @@
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths"/>
android:resource="@xml/file_provider_paths" />
</provider>

<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about"
android:theme="@style/AppTheme.NoActionBar" />
</application>

</manifest>
103 changes: 103 additions & 0 deletions app/src/main/java/ca/pkay/rcloneexplorer/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
34 changes: 15 additions & 19 deletions app/src/main/java/ca/pkay/rcloneexplorer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
25 changes: 25 additions & 0 deletions app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,31 @@ public void moveTo(String remote, String oldFile, String newFile) {
}
}

public String getRcloneVersion() {
String[] command = createCommand("--version");
ArrayList<String> 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";
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_bug_report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5c-0.49,0 -0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM14,16h-4v-2h4v2zM14,12h-4v-2h4v2z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_info_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_libraries.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM19,11L9,11L9,9h10v2zM15,15L9,15v-2h6v2zM19,7L9,7L9,5h10v2z"/>
</vector>
4 changes: 4 additions & 0 deletions app/src/main/res/drawable/ic_mark_github.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="16"
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:fillType="evenOdd" android:pathData="M8,0C3.58,0 0,3.58 0,8c0,3.54 2.29,6.53 5.47,7.59 0.4,0.07 0.55,-0.17 0.55,-0.38 0,-0.19 -0.01,-0.82 -0.01,-1.49 -2.01,0.37 -2.53,-0.49 -2.69,-0.94 -0.09,-0.23 -0.48,-0.94 -0.82,-1.13 -0.28,-0.15 -0.68,-0.52 -0.01,-0.53 0.63,-0.01 1.08,0.58 1.23,0.82 0.72,1.21 1.87,0.87 2.33,0.66 0.07,-0.52 0.28,-0.87 0.51,-1.07 -1.78,-0.2 -3.64,-0.89 -3.64,-3.95 0,-0.87 0.31,-1.59 0.82,-2.15 -0.08,-0.2 -0.36,-1.02 0.08,-2.12 0,0 0.67,-0.21 2.2,0.82 0.64,-0.18 1.32,-0.27 2,-0.27 0.68,0 1.36,0.09 2,0.27 1.53,-1.04 2.2,-0.82 2.2,-0.82 0.44,1.1 0.16,1.92 0.08,2.12 0.51,0.56 0.82,1.27 0.82,2.15 0,3.07 -1.87,3.75 -3.65,3.95 0.29,0.25 0.54,0.73 0.54,1.48 0,1.07 -0.01,1.93 -0.01,2.2 0,0.21 0.15,0.46 0.55,0.38A8.013,8.013 0,0 0,16 8c0,-4.42 -3.58,-8 -8,-8z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_person_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,5.9c1.16,0 2.1,0.94 2.1,2.1s-0.94,2.1 -2.1,2.1S9.9,9.16 9.9,8s0.94,-2.1 2.1,-2.1m0,9c2.97,0 6.1,1.46 6.1,2.1v1.1L5.9,18.1L5.9,17c0,-0.64 3.13,-2.1 6.1,-2.1M12,4C9.79,4 8,5.79 8,8s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,13c-2.67,0 -8,1.34 -8,4v3h16v-3c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>
26 changes: 26 additions & 0 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DDDDDD"
tools:context=".AboutActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_about" />

</android.support.design.widget.CoordinatorLayout>
Loading

0 comments on commit 8427ae6

Please sign in to comment.