Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davide-imbriaco committed Apr 28, 2017
1 parent 7728763 commit a260f73
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 63 deletions.
6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![MPLv2 License](https://img.shields.io/badge/license-MPLv2-blue.svg?style=flat-square)](https://www.mozilla.org/MPL/2.0/)

This project is an android app, that works as a client for a [Syncthing][1] share (accessing syncthing devices in the same way a client-server file sharing app access its proprietary server).
This project is an android app, that works as a client for a [Syncthing][1] share (accessing syncthing devices in the same way a client-server file sharing app access its proprietary server). You can find the app on [Google Play Store][4].
This project is based on [a-sync][2], a java implementation of Syncthing protocols (bep, discovery, relay).

NOTE: this is a client-oriented implementation, designed to work online by downloading and uploading files from an active device on the network (instead of synchronizing a local copy of the entire repository). This is quite different from the way the original Syncthing app works, and its useful from those devices that cannot or wish not to download the entire repository (for example, mobile devices with limited storage available, wishing to access a syncthing share).
Expand All @@ -20,5 +20,5 @@ If you like this work, please donate something to help its development!
[1]: https://syncthing.net/
[2]: https://github.com/davide-imbriaco/a-sync
[3]: https://github.com/davide-imbriaco/a-sync-browser/blob/master/LICENSE

[4]: https://play.google.com/store/apps/details?id=it.anyplace.syncbrowser

6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "it.anyplace.syncbrowser"
minSdkVersion 19
targetSdkVersion 25
versionCode 2
versionName "1.2"
versionCode 3
versionName "1.3"
jackOptions {
enabled true
}
Expand All @@ -24,7 +24,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
compile ('it.anyplace.sync:a-sync-client:1.1') {
compile ('it.anyplace.sync:a-sync-client:1.2') {
exclude group: 'commons-logging', module:'commons-logging'
exclude group: 'commons-cli'
exclude group: 'commons-codec'
Expand Down

This file was deleted.

33 changes: 32 additions & 1 deletion app/src/main/java/it/anyplace/syncbrowser/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
import static org.apache.commons.lang3.StringUtils.isBlank;

//TODO move interface code to fragment
public class MainActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity implements ActivityCompat.OnRequestPermissionsResultCallback {

private ConfigurationService configuration;
private SyncthingClient syncthingClient;
Expand Down Expand Up @@ -184,11 +184,41 @@ public void run() {
}
}


@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
Log.i("MainActivity", "onRequestPermissionsResult: "+Joiner.on(",").join(permissions)+" -> "+Joiner.on(",").join(Arrays.asList(grantResults)));
Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage( getBaseContext().getPackageName() );
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Log.i("MainActivity","onRequestPermissionsResult: restart app for new permissions");
finish();
startActivity(intent);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i("onCreate", "BEGIN");
super.onCreate(savedInstanceState);


{
Log.i("MainActivity", "check permissions BEGIN");
List<String> requests = Lists.newArrayList();
for (String requiredPermission : Arrays.asList(
Manifest.permission.INTERNET,
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
int permissionCheck = ContextCompat.checkSelfPermission(this, requiredPermission);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
Log.i("MainActivity.onCreate", "app is missing permission " + requiredPermission + ", sending request");
requests.add(requiredPermission);
}
}
if (!requests.isEmpty()) {
ActivityCompat.requestPermissions(MainActivity.this, requests.toArray(new String[]{}), 13);
}
Log.i("MainActivity", "check permissions END");
}

setContentView(R.layout.main_container);

((ListView) findViewById(R.id.main_folder_and_files_list_view)).setEmptyView(findViewById(R.id.main_list_view_empty_element));
Expand Down Expand Up @@ -513,6 +543,7 @@ private void exitSearchMode(){
searchModeOn=false;
ListView listView = (ListView) findViewById(R.id.main_search_results_list_view);
listView.setEmptyView(null);
((TextView)findViewById(R.id.main_search_results_empty_element)).setVisibility(View.GONE);
listView.setAdapter(null);
updateButtonsVisibility();
indexFinder.close();
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 0 additions & 5 deletions app/src/main/res/drawable/ic_cellphone_black_24dp.xml

This file was deleted.

8 changes: 5 additions & 3 deletions app/src/main/res/layout/main_content.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!--top bar BEGIN-->
Expand Down Expand Up @@ -66,11 +67,12 @@
<!--center content BEGIN-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_below="@+id/main_header"
android:orientation="vertical"
android:divider="?android:listDivider"
android:showDividers="middle">
android:showDividers="middle"
android:layout_alignParentBottom="true">

<!--index loading progress BEGIN-->
<LinearLayout
Expand Down
17 changes: 0 additions & 17 deletions app/src/test/java/it/anyplace/syncbrowser/ExampleUnitTest.java

This file was deleted.

0 comments on commit a260f73

Please sign in to comment.