Skip to content

Commit

Permalink
Merge pull request #1 from stefan-niedermann/master
Browse files Browse the repository at this point in the history
get up to date
  • Loading branch information
HeaDBanGer84 committed Jan 4, 2016
2 parents c77c9cf + d424f38 commit bc30f1f
Show file tree
Hide file tree
Showing 25 changed files with 363 additions and 301 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# ownCloud Notes
An android client for OwnCloud Notes App.
An android client for [ownCloud Notes App](https://github.com/owncloud/notes/).

:construction: **Warning:** This app is beta. This means it is not tested well (only by some VMs and my personal device).

:arrow_forward: **Access:** Since this app is currently not available in any Appstore, i will provide some versions in [my ownCloud instance](http://owncloud.niedermann.it/index.php/s/BOM5V1VZwscFk1k). Feel free to download and distribute. But *be careful*: This kind of installation does not include any kind of automatic updates, so you will have to check manually for new security and feature updates.

## :rocket: Features
* List, Create, Edit, Share and Delete Notes
* Share Text and Links as new Note into the App
* Bulk Delete
* Render MarkDown (using [AndDown](https://github.com/commonsguy/cwac-anddown))
* Render MarkDown (using [Bypass](https://github.com/Uncodin/bypass))
* English, German and Serbian UI

## :checkered_flag: Planned Features
Expand All @@ -30,8 +32,8 @@ An android client for OwnCloud Notes App.
* Send me a bottle of your favorite beer :beers: :wink:

## :link: Requirements
* [OwnCloud](https://github.com/owncloud/) instance running
* [OwnCloud Notes](https://github.com/owncloud/notes) app enabled
* [ownCloud](https://github.com/owncloud/) instance running
* [ownCloud Notes](https://github.com/owncloud/notes) app enabled

## :notebook: License
This Project is licensed under the [GNU GENERAL PUBLIC LICENSE](/LICENSE).
Expand Down
12 changes: 3 additions & 9 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,23 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debugAndroidTest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/gridlayout-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.commit451/bypasses/1.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "it.niedermann.owncloud.notes"
minSdkVersion 22
targetSdkVersion 23
versionCode 3
versionName "0.3.0"
versionCode 4
versionName "0.4.0"
}
buildTypes {
release {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest
package="it.niedermann.owncloud.notes"
android:versionCode="3"
android:versionName="0.3.0">
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="4"
android:versionName="0.4.0">

<uses-sdk
android:minSdkVersion="11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import android.support.v7.app.AppCompatActivity;

import it.niedermann.owncloud.notes.R;

public class AboutActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.widget.EditText;

import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.model.Note;
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;

public class CreateNoteActivity extends AppCompatActivity {
Expand Down Expand Up @@ -49,10 +48,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
editTextField.setEnabled(false);
String content = editTextField.getText().toString();
NoteSQLiteOpenHelper db = new NoteSQLiteOpenHelper(this);
db.addNoteAndSync(content);
Intent data = new Intent();
//FIXME send correct note back to NotesListView
data.putExtra(NotesListViewActivity.CREATED_NOTE, new Note(-1, null, "", content));
data.putExtra(NotesListViewActivity.CREATED_NOTE, db.getNote(db.addNoteAndSync(content)));
setResult(RESULT_OK, data);
finish();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,81 +16,103 @@
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.model.Note;
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
import it.niedermann.owncloud.notes.util.ICallback;

public class EditNoteActivity extends AppCompatActivity {
private final long DELAY = 1000; // in ms
private EditText content = null;
private Note note = null;
private Timer timer = new Timer();
private final long DELAY = 1000; // in ms
private EditText content = null;
private Note note = null;
private Timer timer = new Timer();

@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
note = (Note) getIntent().getSerializableExtra(
NoteActivity.EDIT_NOTE);
content = (EditText) findViewById(R.id.editContent);
content.setEnabled(false);
content.setText(note.getContent());
content.setEnabled(true);
content.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
NoteActivity.EDIT_NOTE);
content = (EditText) findViewById(R.id.editContent);
content.setEnabled(false);
content.setText(note.getContent());
content.setEnabled(true);
content.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}

@Override
public void onTextChanged(final CharSequence s, int start, int before,
int count) {
if (timer != null)
timer.cancel();
}
@Override
public void onTextChanged(final CharSequence s, int start, int before,
int count) {
if (timer != null)
timer.cancel();
}

@Override
public void afterTextChanged(final Editable s) {
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
saveData();
}
});
}
}, DELAY);
}
});
}
@Override
public void afterTextChanged(final Editable s) {
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
saveData();
}
});
}
}, DELAY);
}
});
}

@Override
public void onBackPressed() {
content.setEnabled(false);
saveData();
Intent data = new Intent();
data.setAction(Intent.ACTION_VIEW);
data.putExtra(NoteActivity.EDIT_NOTE, note);
setResult(RESULT_OK, data);
finish();
}
@Override
public void onBackPressed() {
content.setEnabled(false);
saveData();
Intent data = new Intent();
data.setAction(Intent.ACTION_VIEW);
data.putExtra(NoteActivity.EDIT_NOTE, note);
setResult(RESULT_OK, data);
finish();
}

private void saveData() {
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setSubtitle(getResources().getString(R.string.action_edit_saving));
}
note.setContent(((EditText) findViewById(R.id.editContent)).getText().toString());
NoteSQLiteOpenHelper db = new NoteSQLiteOpenHelper(this);
db.updateNoteAndSync(note);
if (ab != null) {
getSupportActionBar().setSubtitle(getResources().getString(R.string.action_edit_saved));
}
Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() {
@Override
public void run() {
getSupportActionBar().setSubtitle(null);
}
}, 1, TimeUnit.SECONDS);
}
private void saveData() {
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setSubtitle(getResources().getString(R.string.action_edit_saving));
}
note.setContent(((EditText) findViewById(R.id.editContent)).getText().toString());
NoteSQLiteOpenHelper db = new NoteSQLiteOpenHelper(this);
db.getNoteServerSyncHelper().addCallback(new ICallback() {
@Override
public void onFinish() {
runOnUiThread(new Runnable() {
@Override
public void run() {
getSupportActionBar().setSubtitle(getResources().getString(R.string.action_edit_saved));
Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
getSupportActionBar().setSubtitle(null);
}
});
}
}, 1, TimeUnit.SECONDS);
}
});

/* TODO Notify widgets
int widgetIDs[] = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds(new ComponentName(getApplication(), SingleNoteWidget.class));
for (int id : widgetIDs) {
AppWidgetManager.getInstance(getApplication()).notifyAppWidgetViewDataChanged(id, R.layout.widget_single_note);
}*/
}
});
db.updateNoteAndSync(note);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.menu_delete:
db = new NoteSQLiteOpenHelper(this);
db.deleteNoteAndSync(note.getId());
Intent data = new Intent();
data.putExtra(NotesListViewActivity.SELECTED_NOTE_POSITION,
notePosition);
setResult(RESULT_FIRST_USER, data);
finish();
return true;
case R.id.menu_share:
Expand Down Expand Up @@ -102,11 +106,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Note editedNote = (Note) data.getExtras().getSerializable(
EDIT_NOTE);
if (editedNote != null) {
noteContent.setText(editedNote.getSpannableContent());
actionBar.setTitle(editedNote.getTitle());
actionBar.setSubtitle(editedNote.getModified("dd.MM.yyyy HH:mm"));
note = editedNote;
noteContent.setText(note.getSpannableContent());
actionBar.setTitle(note.getTitle());
actionBar.setSubtitle(note.getModified("dd.MM.yyyy HH:mm"));
}
// TODO Fire changed note to noteslistviewactivity
data.putExtra(NotesListViewActivity.SELECTED_NOTE_POSITION,
notePosition);
setResult(RESULT_OK, data);
Expand Down
Loading

0 comments on commit bc30f1f

Please sign in to comment.