11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
19 |
24 |
25 |
29 |
30 |
34 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
49 |
50 |
55 |
56 |
60 |
61 |
66 |
67 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/CONTRIBUTING.rst:
--------------------------------------------------------------------------------
1 | ************
2 | Contributing
3 | ************
4 |
5 | If you want to contribute, you are more than welcome. There is only one thing you should keep in mind:
6 |
7 | 1. **Always write code in the development branch. The master branch is for package maintainers only. We will not accept pull requests based on the master branch.**
8 | 2. **!!! Your submissions will be GPL3. If you are not ok with this, don't submit your code !!!**
9 |
10 | That's it. If you have no idea where to help out:
11 |
12 | * check the issues list,
13 | * write a translation,
14 | * proof read code,
15 | * proof read translations
16 |
17 | Together we are be able to write a really good application for all of us.
18 |
19 |
20 | How to submit bugs / issues
21 | ===========================
22 | Bugs are nasty and we hate them as much as you do. Whenever you submit an issue, provide the following information. This is not to annoy you! Without that information, we don't know where to look:
23 |
24 | Provide all details concerning your software environment
25 | --------------------------------------------------------
26 | * ownCloud server version: https://yourcloud/index.php/settings/admin
27 | * ownCloud encryption plugin installed and enabled and if so, the version
28 | * Android / CM / whateverdistroyouhave Version
29 |
30 | Provide all details concerning the specific issue
31 | -------------------------------------------------
32 | * Update My Own Notes to latest version. If you are using F-Droid, that may take a day or two. Look at `our git repository`_ and browse the tags to see which version is the newest one.
33 | * Enable extensive LogCat messages under "Settings/Debug" in MyOwnNotes.
34 | * Submit the crash report on your phone. This way we can determine the problem in the google developers console (please be aware that you are sending the crash report to google).
35 | * If you don't want to send data to google: send us the Output of `logcat`_
36 | * Or look at /data/anr/traces.txt on your device and submit the crash log
37 |
38 |
39 | How to submit feature requests
40 | ==============================
41 | New features are great, but feature requests can be annoying as hell. Here is how to write feature requests that may be fulfilled sometimes:
42 |
43 | - Ask yourself if you really need this feature.
44 | - Look into github. Has someone else submitted the same feature request? Please look at the closed issues as well!
45 | - Ask yourself why you need this feature although no one else asked for it.
46 | - Look at the app. Maybe the feature is already in there! If it's there but it took you too long to find it, please submit an issue. It means that our UX design is bad.
47 | - Are you the only person in the world who may need this feature? E.g. "I invented a new format and My Own Notes should support it."
48 | - We ignore every feature request not provided in Gherkin. See below for how to correctly submit Gherkin style feature requests.
49 |
50 |
51 | Gherkin?
52 | --------
53 | Gerkhin is a language for application testing. When you submit your feature request in Gherkin, you make sure that your feature can be automatically tested when it arrives. Big plus for code quality!
54 |
55 | Take a look at `Gherkin documentation`_ for how-to write it. Here is an `Real World Gherkin Example`_:
56 |
57 | .. code-block:: cucumber
58 |
59 | Feature: Share with My Own Notes
60 | Text in other applications should have a Share-With My Own notes option.
61 | This creates a new note where the content of the new note is the text selected
62 | in the application.
63 |
64 | Scenario: Showing Share with My Own Notes option
65 | Given that there is text selected in any application not being My Own Notes
66 | When I press on the system wide Share-To Button
67 | Then I see the option "Share with My Own Notes"
68 |
69 | Scenario: Sharing text with My Own Notes
70 | Given that there is text selected in any application not being My Own Notes
71 | And Share-To has been pressed
72 | When I select Share With My Own Notes
73 | Then the application My Own Notes is opened
74 | And a new note is created
75 | And the selected text is the text of the new note
76 |
77 |
78 | How to submit translations
79 | ==========================
80 |
81 | New Translations
82 | ----------------
83 | To avoid incomplete translations, new ones will be added in a seperate branch. Please submit an issue and we will add this branch for you. Be aware that all new translations should be proof read by at least one other user before being merged into the development branch. If no one complains about the translation in a week's time, the pull request is treated as being ok and will be merged.
84 |
85 | Improving existing translations
86 | -------------------------------
87 | Just do your edits in the development branch.
88 |
89 | Proof read translations
90 | -----------------------
91 | This is crucial. You really need to proof read your translations!
92 |
93 | Critical Translations
94 | ---------------------
95 | Translation requests (issues) blocking critical bugfixes will be marked as critical. If they are not provided 48 hours later, the release containing critical bugfixes will be distributed nevertheless. The translation request will be marked "critical, delayed" and should be treated with uttermost priority.
96 |
97 |
98 | How to submit code
99 | ==================
100 |
101 | 1. Check
102 | 2. Double Check
103 | 3. Test
104 | 4. Test with a second device
105 | 5. Beautify
106 | 6. Repeat Steps 1-5 as often as necessary
107 | 7. `Submit`_
108 |
109 | Notes regarding the workflow
110 | ----------------------------
111 | * New entries in values/strings.xml have to be added in all other languages as well. That way, translators will be able to find new strings easily. Additionally, the code does not break if a string is forgotten.
112 |
113 |
114 | License
115 | =======
116 | One last note: This application is licensed under `GPL 3`_. All code submitted will be released under the same license. For more information, look at the LICENSE file.
117 |
118 | .. _Gherkin documentation: https://github.com/cucumber/cucumber/wiki/Gherkin
119 | .. _GPL 3: http://www.gnu.org/copyleft/gpl.html
120 | .. _logcat: http://wiki.cyanogenmod.org/w/Doc:_debugging_with_logcat
121 | .. _network graph: https://github.com/aykit/myownnotes-android/network
122 | .. _our git repository: https://github.com/aykit/myownnotes-android
123 | .. _Real World Gherkin Example: https://github.com/aykit/myownnotes-android/issues/89
124 | .. _Submit: https://help.github.com/categories/63/articles
125 |
--------------------------------------------------------------------------------
/Gfx/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/Gfx/.DS_Store
--------------------------------------------------------------------------------
/Gfx/Smartphone/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/Gfx/Smartphone/.DS_Store
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | ==============
2 | MyOwnNotes 2
3 | ==============
4 |
5 | This project is no longer maintained
6 | ====================================
7 |
8 | If you want to become maintainer, post here: https://github.com/aykit/MyOwnNotes/issues/163
9 |
10 |
11 | Information
12 | ===========
13 |
14 | This is Version 2, a complete rewrite of MyOwnNotes. This application does not depend on the server side owncloud notes app anymore. However, it does depend on the `ownCloud android application`_ for authentication.
15 |
16 | MyOwnNotes 2 has not been released on the official android store yet. Release will follow in the next couple of weeks. Feel free to add issues after consulting the CONTRIBUTING.rst file.
17 |
18 |
19 | The right README
20 | ================
21 | Make sure you read the README of the appropriate branch. The one you are seeing right now might not be the one you are looking for.
22 |
23 |
24 | Contribute
25 | ==========
26 | Please take a look at CONTRIBUTING.rst for information regarding extending this application.
27 |
28 | The information there applies to **translations** and **issue submissions** as well.
29 |
30 |
31 | Install
32 | =======
33 | to use this app you will need:
34 |
35 | + ownCloud server Version >= 9.0 see `ownCloud Docs`_
36 | + Mobile device using Android Version >= 5.0
37 |
38 |
39 | .. _`FAQ`:
40 |
41 | FAQ
42 | ===
43 |
44 | How do I get ownCloud?
45 | ----------------------
46 |
47 | See the `ownCloud website`_ for more information.
48 |
49 |
50 | What do you think about nextcloud?
51 | ----------------------------------
52 |
53 | We did not think much about it. That was easy, thanks to tobiasKaminsky_. For reference, a good insight into the split is probably `carla's blog entry`_.
54 |
55 |
56 | Contributors of Version 2.x
57 | ===========================
58 |
59 | Maintainer
60 | ----------
61 | * `aykit`_ : Non-profit organisation supporting art, culture and science
62 |
63 | Developers
64 | ----------
65 | * `kh0r`_: Main author of Revision 2.0
66 | * tobiasKaminsky_: NextCloud support
67 | * nobse_: Small changes
68 |
69 |
70 | Contributors of Version 1.x
71 | ===========================
72 |
73 | Here is a list of all contributers, including ourselves. A big thank you to all the people who help developing this application. Please be aware that all contributions are GPL3 licensed.
74 |
75 | Maintainer
76 | ----------
77 | * `aykit`_ : Non-profit organisation supporting art, culture and science
78 |
79 | Developers
80 | ----------
81 | * Main Developer: `steppenhahn`_
82 |
83 | Translators
84 | -----------
85 | * French: `flo1`_ , `gityeti`_
86 | * Serbian: `pejakm`_
87 | * Spanish: `tmelikoff`_
88 | * Turkish: `wakeup`_
89 |
90 | Testers
91 | -------
92 | Unfortunately, we are not able to greet everyone in person. Without your feedback, we wouldn't be able to improve My Own Notes. Please keep up testing and providing valuable information regarding your issues. We promise we will keep up fixing and improving as best as we can.
93 |
94 |
95 | License
96 | =======
97 | My Own Notes and all contributions are licensed as `GPL3`_
98 |
99 |
100 | .. _CheapSSLsecurity: https://cheapsslsecurity.com
101 | .. _carla's blog entry: https://web.archive.org/web/20170404145931/http://carlaschroder.com/nextcloud-is-dirty-deal/
102 | .. _contact us: mailto:z-o48hohw4l9qla@ay.vc
103 | .. _Entwicklerbier.org: https://blog.entwicklerbier.org/2014/05/securing-the-internet-of-things-how-about-securing-the-internet-first/
104 | .. _google dev: https://code.google.com/p/android/issues/detail?id=11231#c107
105 | .. _google summer of code: https://summerofcode.withgoogle.com/organizations/6453536335331328/
106 | .. _GPL3: https://github.com/aykit/myownnotes-android/blob/master/LICENSE
107 | .. _My Own Notes App: https://github.com/aykit/myownnotes-android
108 | .. _My Own Notes Website: https://aykit.org/sites/myownnotes.html
109 | .. _ownCloud android application: https://play.google.com/store/apps/details?id=com.owncloud.android
110 | .. _ownCloud Docs: http://doc.owncloud.org/
111 | .. _ownCloud website: https://owncloud.org/install/
112 | .. _SSL Labs: https://www.ssllabs.com/ssltest/
113 | .. _StartSSL: https://startssl.com
114 | .. _Setting up owncloud on Speed: https://blog.entwicklerbier.org/2014/06/setting-up-owncloud-on-speed/
115 |
116 | .. _aykit: https://aykit.org
117 | .. _flo1: https://github.com/flo1
118 | .. _gityeti: https://github.com/gityeti
119 | .. _pejakm: https://github.com/pejakm
120 | .. _steppenhahn: https://github.com/steppenhahn
121 | .. _tmelikoff: http://https://github.com/tmelikoff
122 | .. _wakeup: https://github.com/wakeup
123 | .. _kh0r: https://github.com/kh0r
124 | .. _tobiasKaminsky: https://github.com/tobiasKaminsky
125 | .. _nobse: https://github.com/nobse
126 |
--------------------------------------------------------------------------------
/VERSION:
--------------------------------------------------------------------------------
1 | Look at AndroidManifest.xml for version information
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | generateLocalDebugSources
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.neenbedankt.android-apt'
3 |
4 | android {
5 | compileSdkVersion 23
6 | buildToolsVersion "23.0.2"
7 | defaultConfig {
8 | applicationId "org.aykit.MyOwnNotes"
9 | minSdkVersion 16
10 | targetSdkVersion 23
11 | versionCode 12
12 | versionName '2.1.1'
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | productFlavors {
21 | local {
22 | applicationId 'org.aykit.MyOwnNotes.local'
23 | resValue "string", "app_name", "MyOwnNotes[Local]"
24 | }
25 | store {
26 | applicationId 'org.aykit.MyOwnNotes'
27 | resValue "string", "app_name", "MyOwnNotes"
28 | }
29 | }
30 | packagingOptions {
31 | exclude 'META-INF/LICENSE.txt'
32 | exclude 'META-INF/NOTICE.txt'
33 | }
34 | }
35 |
36 | dependencies {
37 | compile fileTree(dir: 'libs', include: ['*.jar'])
38 | testCompile 'junit:junit:4.12'
39 | compile 'com.android.support:appcompat-v7:23.1.1'
40 | compile 'com.android.support:support-v4:23.1.1'
41 | compile 'com.android.support:design:23.1.1'
42 | compile 'com.android.support:recyclerview-v7:23.1.1'
43 | apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
44 | compile 'net.simonvt.schematic:schematic:0.6.3'
45 | compile 'com.jakewharton:butterknife:7.0.1'
46 | compile 'com.github.owncloud:android-library:oc-android-library-0.9.8'
47 | compile 'commons-io:commons-io:2.4'
48 |
49 | compile('com.afollestad.material-dialogs:core:0.8.1.0@aar') {
50 | transitive = true
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/mklepp/Documents/android-sdks/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/org/aykit/MyOwnNotes/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
33 |
36 |
37 |
38 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/activities/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.activities;
2 |
3 | import android.Manifest;
4 | import android.accounts.Account;
5 | import android.accounts.AccountManager;
6 | import android.content.DialogInterface;
7 | import android.content.Intent;
8 | import android.content.pm.PackageManager;
9 | import android.net.Uri;
10 | import android.os.AsyncTask;
11 | import android.os.Bundle;
12 | import android.preference.PreferenceManager;
13 | import android.support.annotation.NonNull;
14 | import android.support.design.widget.CoordinatorLayout;
15 | import android.support.design.widget.FloatingActionButton;
16 | import android.support.design.widget.Snackbar;
17 | import android.support.v4.app.ActivityCompat;
18 | import android.support.v4.content.ContextCompat;
19 | import android.support.v7.app.AlertDialog;
20 | import android.support.v7.app.AppCompatActivity;
21 | import android.support.v7.widget.Toolbar;
22 | import android.text.InputType;
23 | import android.view.View;
24 | import android.widget.AdapterView;
25 | import android.widget.ArrayAdapter;
26 | import android.widget.Button;
27 | import android.widget.ListView;
28 | import android.widget.ProgressBar;
29 |
30 | import com.afollestad.materialdialogs.DialogAction;
31 | import com.afollestad.materialdialogs.MaterialDialog;
32 | import com.owncloud.android.lib.common.OwnCloudClient;
33 | import com.owncloud.android.lib.common.OwnCloudClientFactory;
34 | import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;
35 |
36 | import org.aykit.MyOwnNotes.R;
37 | import org.aykit.MyOwnNotes.helpers.Settings;
38 |
39 | import java.util.ArrayList;
40 | import java.util.Arrays;
41 | import java.util.List;
42 |
43 | import butterknife.Bind;
44 | import butterknife.ButterKnife;
45 |
46 | public class LoginActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
47 |
48 | private static final int PERMISSIONS_REQUEST_GET_ACCOUNTS = 1;
49 |
50 | private static final String OWNCLOUD_PACKAGE_NAME = "com.owncloud.android";
51 | private static final String NEXTCLOUD_PACKAGE_NAME = "com.nextcloud.client";
52 |
53 | @Bind(R.id.coordinatorlayout)
54 | CoordinatorLayout coordinatorLayout;
55 |
56 | @Bind(R.id.toolbar)
57 | Toolbar toolbar;
58 |
59 | @Bind(android.R.id.list)
60 | ListView listView;
61 |
62 | @Bind(android.R.id.empty)
63 | Button emptyButton;
64 |
65 | @Bind(android.R.id.progress)
66 | ProgressBar progressBar;
67 |
68 | @Bind(R.id.button_add)
69 | FloatingActionButton addButton;
70 |
71 | @Override
72 | protected void onCreate(Bundle savedInstanceState) {
73 | super.onCreate(savedInstanceState);
74 | setContentView(R.layout.activity_login);
75 | ButterKnife.bind(this);
76 |
77 | toolbar.setTitle(getTitle());
78 |
79 | listView.setEmptyView(emptyButton);
80 | listView.setOnItemClickListener(this);
81 |
82 | addButton.setOnClickListener(new View.OnClickListener() {
83 | @Override
84 | public void onClick(View v) {
85 |
86 | new MaterialDialog.Builder(LoginActivity.this)
87 | .title(R.string.dialog_add_account_title)
88 | .content(R.string.dialog_add_account_message)
89 | .positiveText(R.string.dialog_add_account_owncloud)
90 | .negativeText(R.string.dialog_add_account_nextcloud)
91 | .onPositive(new MaterialDialog.SingleButtonCallback() {
92 | @Override
93 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
94 | openCloudApp(OWNCLOUD_PACKAGE_NAME);
95 | }
96 | })
97 | .onNegative(new MaterialDialog.SingleButtonCallback() {
98 | @Override
99 | public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
100 | openCloudApp(NEXTCLOUD_PACKAGE_NAME);
101 | }
102 | })
103 | .show();
104 |
105 | }
106 | });
107 | }
108 |
109 | @Override
110 | protected void onResume() {
111 | super.onResume();
112 |
113 | checkGetAccountPermission();
114 | }
115 |
116 | private void queryPassword(final Account account) {
117 |
118 | new MaterialDialog.Builder(this)
119 | .title(R.string.settings_text_password)
120 | .content(account.name)
121 | .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
122 | .input(R.string.settings_text_password_hint, 0, new MaterialDialog.InputCallback() {
123 | @Override
124 | public void onInput(MaterialDialog dialog, CharSequence input) {
125 | String password = input.toString();
126 | PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().putString(Settings.PREF_ACCOUNT_PASSWORD, password).apply();
127 |
128 | useAccount(account);
129 | }
130 | })
131 | .negativeText(android.R.string.cancel)
132 | .onNegative(new MaterialDialog.SingleButtonCallback() {
133 | @Override
134 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
135 |
136 | PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().remove(Settings.PREF_ACCOUNT_PASSWORD).apply();
137 | }
138 | })
139 | .show();
140 |
141 | }
142 |
143 | /*
144 | * starts owncloud or nextcloud app
145 | * - if not found open in playstore
146 | * - if playstore not found open in browser
147 | */
148 | public void openCloud(View view) {
149 | new AlertDialog.Builder(this).setTitle("Please choose a cloud!")
150 | .setPositiveButton("Nextcloud", new DialogInterface.OnClickListener() {
151 | @Override
152 | public void onClick(DialogInterface dialogInterface, int i) {
153 | openCloudApp(NEXTCLOUD_PACKAGE_NAME);
154 | }
155 | })
156 | .setNegativeButton("ownCloud", new DialogInterface.OnClickListener() {
157 | @Override
158 | public void onClick(DialogInterface dialogInterface, int i) {
159 | openCloudApp(OWNCLOUD_PACKAGE_NAME);
160 | }
161 | })
162 | .create().show();
163 | }
164 |
165 | private void openCloudApp(String packageName) {
166 | PackageManager manager = getPackageManager();
167 | try {
168 | Intent i = manager.getLaunchIntentForPackage(packageName);
169 | if (i == null) {
170 | throw new PackageManager.NameNotFoundException();
171 | }
172 | i.addCategory(Intent.CATEGORY_LAUNCHER);
173 | startActivity(i);
174 | } catch (PackageManager.NameNotFoundException e) {
175 | try {
176 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)));
177 | } catch (android.content.ActivityNotFoundException anfe) {
178 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)));
179 | }
180 | }
181 | }
182 |
183 | private void checkStoredAccount() {
184 | String storedAccountName = PreferenceManager.getDefaultSharedPreferences(this).getString(Settings.PREF_ACCOUNT_NAME, null);
185 |
186 | Account storedAccount = null;
187 | if (storedAccountName != null) {
188 | for (Account account : getAccounts()) {
189 | if (account.name.equals(storedAccountName)) {
190 | storedAccount = account;
191 | break;
192 | }
193 | }
194 | useAccount(storedAccount);
195 | } else {
196 | showAccounts();
197 | }
198 | }
199 |
200 | private void checkGetAccountPermission(){
201 | // Here, thisActivity is the current activity
202 | if (ContextCompat.checkSelfPermission(this,
203 | Manifest.permission.GET_ACCOUNTS)
204 | != PackageManager.PERMISSION_GRANTED) {
205 |
206 | // Should we show an explanation?
207 | if (ActivityCompat.shouldShowRequestPermissionRationale(this,
208 | Manifest.permission.GET_ACCOUNTS)) {
209 |
210 | new MaterialDialog.Builder(this)
211 | .title(R.string.dialog_permission_title)
212 | .content(R.string.dialog_permission_content)
213 | .positiveText(android.R.string.yes)
214 | .onPositive(new MaterialDialog.SingleButtonCallback() {
215 | @Override
216 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
217 | ActivityCompat.requestPermissions(LoginActivity.this,
218 | new String[]{Manifest.permission.GET_ACCOUNTS},
219 | PERMISSIONS_REQUEST_GET_ACCOUNTS);
220 | }
221 | })
222 | .show();
223 | } else {
224 | ActivityCompat.requestPermissions(LoginActivity.this,
225 | new String[]{Manifest.permission.GET_ACCOUNTS},
226 | PERMISSIONS_REQUEST_GET_ACCOUNTS);
227 | }
228 | } else {
229 | showAccounts();
230 | }
231 | }
232 |
233 | @Override
234 | public void onRequestPermissionsResult(int requestCode,
235 | String permissions[], int[] grantResults) {
236 | switch (requestCode) {
237 | case PERMISSIONS_REQUEST_GET_ACCOUNTS: {
238 | // If request is cancelled, the result arrays are empty.
239 | if (grantResults.length > 0
240 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
241 | showAccounts();
242 | } else {
243 | Snackbar.make(coordinatorLayout, R.string.dialog_permission_denied, Snackbar.LENGTH_LONG).show();
244 | }
245 | return;
246 | }
247 | }
248 | }
249 |
250 | private ArrayList getAccounts() {
251 | ArrayList accounts = new ArrayList<>();
252 | accounts.addAll(Arrays.asList(AccountManager.get(this).getAccountsByType(getString(R.string.owncloud_account_type))));
253 | accounts.addAll(Arrays.asList(AccountManager.get(this).getAccountsByType(getString(R.string.nextcloud_account_type))));
254 |
255 | return accounts;
256 | }
257 |
258 | private void showAccounts() {
259 | ArrayList accounts = getAccounts();
260 |
261 | List accountNames = new ArrayList<>();
262 |
263 | for (Account account: accounts) {
264 | accountNames.add(account.name);
265 | }
266 |
267 | if (accounts.size() == 0) {
268 | emptyButton.animate().alpha(1);
269 | listView.animate().alpha(0);
270 | } else {
271 | listView.animate().alpha(1);
272 | listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, accountNames));
273 | }
274 | }
275 |
276 | private void useAccount(Account selectedAccount) {
277 | if (PreferenceManager.getDefaultSharedPreferences(this).contains(Settings.PREF_ACCOUNT_PASSWORD)) {
278 | new CheckAccountAsyncTask().execute(selectedAccount);
279 | } else {
280 | queryPassword(selectedAccount);
281 | }
282 | }
283 |
284 | @Override
285 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
286 | String accountName = listView.getAdapter().getItem(position).toString();
287 | PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().putString(Settings.PREF_ACCOUNT_NAME, accountName).apply();
288 | PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().remove(Settings.PREF_ACCOUNT_PASSWORD).apply();
289 | checkStoredAccount();
290 | }
291 |
292 | private class CheckAccountAsyncTask extends AsyncTask {
293 | protected void onPreExecute() {
294 | // Runs on the UI thread before doInBackground
295 | // Good for toggling visibility of a progress indicator
296 | progressBar.animate().alpha(1);
297 | listView.animate().alpha(0);
298 | }
299 |
300 | @Override
301 | protected Account doInBackground(Account... selectedAccounts) {
302 |
303 | Account selectedAccount = selectedAccounts[0];
304 | Uri baseUrl = Settings.getAccountURL(selectedAccount.name);
305 | String username = Settings.getAccountUsername(selectedAccount.name);
306 | String password = PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).getString(Settings.PREF_ACCOUNT_PASSWORD, null);
307 | if (password == null) {
308 | return null;
309 | }
310 |
311 | OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(baseUrl, LoginActivity.this, false);
312 |
313 | client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(username, password));
314 |
315 | if (!Settings.checkRemoteAccess(client)) {
316 | return null;
317 | }
318 |
319 | return selectedAccount;
320 | }
321 |
322 | @Override
323 | protected void onPostExecute(Account result) {
324 |
325 | if (result != null) {
326 | String accountName = result.name;
327 | Snackbar.make(coordinatorLayout, accountName, Snackbar.LENGTH_LONG).show();
328 |
329 | startActivity(new Intent(LoginActivity.this, NoteListActivity.class));
330 | finish();
331 |
332 | } else {
333 | PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().remove(Settings.PREF_ACCOUNT_PASSWORD).apply();
334 | Snackbar.make(coordinatorLayout, R.string.toast_check_username_password, Snackbar.LENGTH_LONG).show();
335 | showAccounts();
336 | }
337 | progressBar.animate().alpha(0);
338 | }
339 | }
340 | }
341 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/activities/NoteDetailActivity.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.activities;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.Toolbar;
7 | import android.view.MenuItem;
8 |
9 | import org.aykit.MyOwnNotes.R;
10 | import org.aykit.MyOwnNotes.fragments.NoteDetailFragment;
11 |
12 | /**
13 | * An activity representing a single Note detail screen. This
14 | * activity is only used on handset devices. On tablet-size devices,
15 | * item details are presented side-by-side with a list of items
16 | * in a {@link NoteListActivity}.
17 | *
18 | * This activity is mostly just a 'shell' activity containing nothing
19 | * more than a {@link NoteDetailFragment}.
20 | */
21 | public class NoteDetailActivity extends AppCompatActivity {
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_note_detail);
27 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
28 | setSupportActionBar(toolbar);
29 |
30 | // Show the Up button in the action bar.
31 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
32 |
33 | // savedInstanceState is non-null when there is fragment state
34 | // saved from previous configurations of this activity
35 | // (e.g. when rotating the screen from portrait to landscape).
36 | // In this case, the fragment will automatically be re-added
37 | // to its container so we don't need to manually add it.
38 | // For more information, see the Fragments API guide at:
39 | //
40 | // http://developer.android.com/guide/components/fragments.html
41 | //
42 | if (savedInstanceState == null) {
43 | // Create the detail fragment and add it to the activity
44 | // using a fragment transaction.
45 | Bundle arguments = new Bundle();
46 | arguments.putParcelable(NoteDetailFragment.ARG_NOTE, getIntent().getParcelableExtra(NoteDetailFragment.ARG_NOTE));
47 | NoteDetailFragment fragment = new NoteDetailFragment();
48 | fragment.setArguments(arguments);
49 | getSupportFragmentManager().beginTransaction()
50 | .add(R.id.note_detail_container, fragment)
51 | .commit();
52 | }
53 | }
54 |
55 | @Override
56 | public boolean onOptionsItemSelected(MenuItem item) {
57 | int id = item.getItemId();
58 | if (id == android.R.id.home) {
59 | onBackPressed();
60 | return true;
61 | }
62 | return super.onOptionsItemSelected(item);
63 | }
64 |
65 | @Override
66 | public void onBackPressed() {
67 | startActivity(new Intent(this, NoteListActivity.class));
68 | overridePendingTransition(android.R.anim.fade_in, android.R.anim.slide_out_right);
69 | finish();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/activities/NoteListActivity.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.activities;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.IntentFilter;
7 | import android.database.Cursor;
8 | import android.net.Uri;
9 | import android.os.Bundle;
10 | import android.preference.PreferenceManager;
11 | import android.support.design.widget.FloatingActionButton;
12 | import android.support.design.widget.NavigationView;
13 | import android.support.v4.content.LocalBroadcastManager;
14 | import android.support.v4.widget.DrawerLayout;
15 | import android.support.v7.app.ActionBarDrawerToggle;
16 | import android.support.v7.app.AppCompatActivity;
17 | import android.support.v7.widget.Toolbar;
18 | import android.view.MenuItem;
19 | import android.view.View;
20 | import android.widget.TextView;
21 | import android.widget.Toast;
22 |
23 | import com.afollestad.materialdialogs.DialogAction;
24 | import com.afollestad.materialdialogs.MaterialDialog;
25 |
26 | import org.aykit.MyOwnNotes.BuildConfig;
27 | import org.aykit.MyOwnNotes.R;
28 | import org.aykit.MyOwnNotes.asynctasks.SyncNotesAsyncTask;
29 | import org.aykit.MyOwnNotes.database.NotesProvider;
30 | import org.aykit.MyOwnNotes.database.model.Note;
31 | import org.aykit.MyOwnNotes.fragments.NoteDetailFragment;
32 | import org.aykit.MyOwnNotes.fragments.NoteListFragment;
33 | import org.aykit.MyOwnNotes.helpers.LegacyImporter;
34 | import org.aykit.MyOwnNotes.helpers.Settings;
35 |
36 | import java.util.List;
37 |
38 | import butterknife.Bind;
39 | import butterknife.ButterKnife;
40 |
41 |
42 | /**
43 | * An activity representing a list of Notes. This activity
44 | * has different presentations for handset and tablet-size devices. On
45 | * handsets, the activity presents a list of items, which when touched,
46 | * lead to a {@link NoteDetailActivity} representing
47 | * item details. On tablets, the activity presents the list of items and
48 | * item details side-by-side using two vertical panes.
49 | *
50 | * The activity makes heavy use of fragments. The list of items is a
51 | * {@link NoteListFragment} and the item details
52 | * (if present) is a {@link NoteDetailFragment}.
53 | *
54 | * This activity also implements the required
55 | * {@link NoteListFragment.Callbacks} interface
56 | * to listen for item selections.
57 | */
58 | public class NoteListActivity extends AppCompatActivity
59 | implements NoteListFragment.Callbacks {
60 |
61 | /**
62 | * Whether or not the activity is in two-pane mode, i.e. running on a tablet
63 | * device.
64 | */
65 | private boolean mTwoPane;
66 |
67 | @Bind(R.id.toolbar)
68 | Toolbar toolbar;
69 |
70 | @Bind(R.id.navigation)
71 | NavigationView navigationView;
72 |
73 | @Bind(R.id.drawer_layout)
74 | DrawerLayout drawerLayout;
75 |
76 | @Bind(R.id.button_add)
77 | FloatingActionButton addButton;
78 |
79 | private BroadcastReceiver syncBroadcastReceiver = new BroadcastReceiver() {
80 | @Override
81 | public void onReceive(Context context, Intent intent) {
82 | switch (intent.getAction()) {
83 | case SyncNotesAsyncTask.SYNC_FAILED:
84 | int message = intent.getIntExtra(Intent.EXTRA_TEXT, R.string.toast_connection_error);
85 | Toast.makeText(NoteListActivity.this, message, Toast.LENGTH_LONG).show();
86 | break;
87 | }
88 | }
89 | };
90 |
91 | @Override
92 | protected void onCreate(Bundle savedInstanceState) {
93 | super.onCreate(savedInstanceState);
94 | setContentView(R.layout.activity_note_app_bar);
95 | ButterKnife.bind(this);
96 |
97 | checkForLegacyDatabase();
98 |
99 | setSupportActionBar(toolbar);
100 | toolbar.setTitle(getTitle());
101 |
102 | addButton.setOnClickListener(new View.OnClickListener() {
103 | @Override
104 | public void onClick(View v) {
105 | final Context appContext = getApplicationContext();
106 | new Thread(new Runnable() {
107 | @Override
108 | public void run() {
109 | Note newNote = new Note();
110 | Uri uri = appContext.getContentResolver().insert(NotesProvider.NOTES.CONTENT_URI, newNote.getContentValues());
111 | if (uri != null) {
112 | Cursor result = appContext.getContentResolver().query(uri, null, null, null, null);
113 | if (result != null) {
114 | result.moveToFirst();
115 | newNote = new Note(result);
116 | result.close();
117 | onNoteSelected(newNote);
118 | }
119 | }
120 | }
121 | }).start();
122 | }
123 | });
124 |
125 | if (findViewById(R.id.note_detail_container) != null) {
126 | // The detail container view will be present only in the
127 | // large-screen layouts (res/values-large and
128 | // res/values-sw600dp). If this view is present, then the
129 | // activity should be in two-pane mode.
130 | mTwoPane = true;
131 | }
132 |
133 | navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
134 | @Override
135 | public boolean onNavigationItemSelected(MenuItem item) {
136 | int id = item.getItemId();
137 | if (id == R.id.action_logout) {
138 |
139 | // do logout stuff
140 | new MaterialDialog.Builder(NoteListActivity.this)
141 | .title(R.string.dialog_logout_title)
142 | .positiveText(android.R.string.yes)
143 | .onPositive(new MaterialDialog.SingleButtonCallback() {
144 | @Override
145 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
146 | Settings.clearApp(NoteListActivity.this);
147 | finish();
148 | startActivity(new Intent(NoteListActivity.this, LoginActivity.class));
149 | }
150 | })
151 | .negativeText(android.R.string.no)
152 | .show();
153 | }
154 | return false;
155 | }
156 | });
157 |
158 | MenuItem logoutItem = navigationView.getMenu().getItem(0);
159 | if (logoutItem != null){
160 | String username = PreferenceManager.getDefaultSharedPreferences(this).getString(Settings.PREF_ACCOUNT_NAME, "");
161 | logoutItem.setTitle(username);
162 | }
163 |
164 | TextView appNameView = (TextView)navigationView.getHeaderView(0).findViewById(R.id.app_name);
165 | if (appNameView != null){
166 | appNameView.setText(appNameView.getText()+" "+ BuildConfig.VERSION_NAME);
167 | }
168 |
169 | ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this,drawerLayout,toolbar,R.string.drawer_open, R.string.drawer_closed){
170 |
171 | @Override
172 | public void onDrawerClosed(View drawerView) {
173 | // Code here will be triggered once the drawer closes as we dont want anything to happen so we leave this blank
174 | super.onDrawerClosed(drawerView);
175 | }
176 |
177 | @Override
178 | public void onDrawerOpened(View drawerView) {
179 | // Code here will be triggered once the drawer open as we dont want anything to happen so we leave this blank
180 |
181 | super.onDrawerOpened(drawerView);
182 | }
183 | };
184 |
185 | //Setting the actionbarToggle to drawer layout
186 | drawerLayout.setDrawerListener(actionBarDrawerToggle);
187 |
188 | //calling sync state is necessay or else your hamburger icon wont show up
189 | actionBarDrawerToggle.syncState();
190 | }
191 |
192 | @Override
193 | protected void onResume() {
194 | super.onResume();
195 |
196 | IntentFilter filter = new IntentFilter();
197 | filter.addAction(SyncNotesAsyncTask.SYNC_FAILED);
198 |
199 | LocalBroadcastManager.getInstance(this).registerReceiver(syncBroadcastReceiver, filter);
200 |
201 | // start sync after registering receiver
202 | SyncNotesAsyncTask.start(this);
203 | }
204 |
205 | @Override
206 | protected void onPause() {
207 | super.onPause();
208 |
209 | LocalBroadcastManager.getInstance(this).unregisterReceiver(syncBroadcastReceiver);
210 |
211 | }
212 |
213 | /**
214 | * Callback method from {@link NoteListFragment.Callbacks}
215 | * indicating that the item with the given ID was selected.
216 | */
217 | @Override
218 | public void onNoteSelected(Note note) {
219 | Bundle arguments = new Bundle();
220 | arguments.putParcelable(NoteDetailFragment.ARG_NOTE, note);
221 | if (mTwoPane) {
222 | // In two-pane mode, show the detail view in this activity by
223 | // adding or replacing the detail fragment using a
224 | // fragment transaction.
225 | NoteDetailFragment fragment = new NoteDetailFragment();
226 | fragment.setArguments(arguments);
227 | getSupportFragmentManager().beginTransaction()
228 | .replace(R.id.note_detail_container, fragment)
229 | .commit();
230 |
231 | } else {
232 | // In single-pane mode, simply start the detail activity
233 | // for the selected item
234 | Intent detailIntent = new Intent(this, NoteDetailActivity.class);
235 | detailIntent.putExtras(arguments);
236 | startActivity(detailIntent);
237 |
238 | overridePendingTransition(R.anim.slide_in_right, android.R.anim.fade_out);
239 | }
240 | }
241 |
242 | @Override
243 | public void onNoteSwiped(final Note note) {
244 | new MaterialDialog.Builder(this)
245 | .title(R.string.dialog_delete_title)
246 | .content(note.title)
247 | .positiveText(android.R.string.yes)
248 | .onPositive(new MaterialDialog.SingleButtonCallback() {
249 | @Override
250 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
251 | new Thread(new Runnable() {
252 | @Override
253 | public void run() {
254 | note.setDeleted();
255 | getContentResolver().update(NotesProvider.NOTES.withId(note.id), note.getContentValues(), null, null);
256 | SyncNotesAsyncTask.start(NoteListActivity.this);
257 | }
258 | }).start();
259 | }
260 | })
261 | .negativeText(android.R.string.no)
262 | .show();
263 | }
264 |
265 | private void checkForLegacyDatabase(){
266 | LegacyImporter importer = new LegacyImporter(this);
267 | if (importer.checkForMigration()){
268 | final List extractedNotes = importer.extractNotes();
269 |
270 | new Thread(new Runnable() {
271 | @Override
272 | public void run() {
273 | for (Note note : extractedNotes) {
274 | getContentResolver().insert(NotesProvider.NOTES.CONTENT_URI, note.getContentValues());
275 | }
276 | SyncNotesAsyncTask.start(NoteListActivity.this);
277 | }
278 | }).start();
279 | }
280 | }
281 | }
282 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/adapter/DividerItemDecoration.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.adapter;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Rect;
7 | import android.graphics.drawable.Drawable;
8 | import android.support.v7.widget.LinearLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.view.View;
11 |
12 | /**
13 | * Created by mklepp on 22/11/15.
14 | */
15 | /*
16 | * Copyright (C) 2014 The Android Open Source Project
17 | *
18 | * Licensed under the Apache License, Version 2.0 (the "License");
19 | * you may not use this file except in compliance with the License.
20 | * You may obtain a copy of the License at
21 | *
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | *
24 | * Unless required by applicable law or agreed to in writing, software
25 | * distributed under the License is distributed on an "AS IS" BASIS,
26 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 | * See the License for the specific language governing permissions and
28 | * limitations under the License.
29 | */
30 | public class DividerItemDecoration extends RecyclerView.ItemDecoration {
31 |
32 | private static final int[] ATTRS = new int[]{
33 | android.R.attr.listDivider
34 | };
35 |
36 | public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;
37 |
38 | public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
39 |
40 | private Drawable mDivider;
41 |
42 | private int mOrientation;
43 |
44 | public DividerItemDecoration(Context context, int orientation) {
45 | final TypedArray a = context.obtainStyledAttributes(ATTRS);
46 | mDivider = a.getDrawable(0);
47 | a.recycle();
48 | setOrientation(orientation);
49 | }
50 |
51 | public void setOrientation(int orientation) {
52 | if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) {
53 | throw new IllegalArgumentException("invalid orientation");
54 | }
55 | mOrientation = orientation;
56 | }
57 |
58 | @Override
59 | public void onDraw(Canvas c, RecyclerView parent) {
60 | if (mOrientation == VERTICAL_LIST) {
61 | drawVertical(c, parent);
62 | } else {
63 | drawHorizontal(c, parent);
64 | }
65 | }
66 |
67 | public void drawVertical(Canvas c, RecyclerView parent) {
68 | final int left = parent.getPaddingLeft();
69 | final int right = parent.getWidth() - parent.getPaddingRight();
70 |
71 | final int childCount = parent.getChildCount();
72 | for (int i = 0; i < childCount; i++) {
73 | final View child = parent.getChildAt(i);
74 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
75 | .getLayoutParams();
76 | final int top = child.getBottom() + params.bottomMargin;
77 | final int bottom = top + mDivider.getIntrinsicHeight();
78 | mDivider.setBounds(left, top, right, bottom);
79 | mDivider.draw(c);
80 | }
81 | }
82 |
83 | public void drawHorizontal(Canvas c, RecyclerView parent) {
84 | final int top = parent.getPaddingTop();
85 | final int bottom = parent.getHeight() - parent.getPaddingBottom();
86 |
87 | final int childCount = parent.getChildCount();
88 | for (int i = 0; i < childCount; i++) {
89 | final View child = parent.getChildAt(i);
90 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
91 | .getLayoutParams();
92 | final int left = child.getRight() + params.rightMargin;
93 | final int right = left + mDivider.getIntrinsicHeight();
94 | mDivider.setBounds(left, top, right, bottom);
95 | mDivider.draw(c);
96 | }
97 | }
98 |
99 | @Override
100 | public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) {
101 | if (mOrientation == VERTICAL_LIST) {
102 | outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
103 | } else {
104 | outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/adapter/NotesListAdapter.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.adapter;
2 |
3 | /**
4 | * Created by mklepp on 22/11/15.
5 | */
6 | import android.content.Context;
7 | import android.database.Cursor;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.AdapterView;
13 | import android.widget.TextView;
14 |
15 | import org.aykit.MyOwnNotes.R;
16 | import org.aykit.MyOwnNotes.database.NoteColumns;
17 | import org.aykit.MyOwnNotes.database.model.Note;
18 |
19 | import butterknife.Bind;
20 | import butterknife.ButterKnife;
21 |
22 | public class NotesListAdapter extends RecyclerView.Adapter {
23 |
24 | private Cursor mCursor;
25 | private AdapterView.OnItemClickListener mOnItemClickListener;
26 |
27 | public NotesListAdapter(Cursor cursor) {
28 | mCursor = cursor;
29 | }
30 |
31 | @Override
32 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33 | Context context = parent.getContext();
34 | LayoutInflater inflater = LayoutInflater.from(context);
35 |
36 | // Inflate the custom layout
37 | View contactView = inflater.inflate(R.layout.row_note, parent, false);
38 |
39 | // Return a new holder instance
40 | ViewHolder viewHolder = new ViewHolder(contactView, this);
41 | return viewHolder;
42 | }
43 |
44 | @Override
45 | public void onBindViewHolder(ViewHolder holder, int position) {
46 | mCursor.moveToPosition(position);
47 | String title = mCursor.getString(mCursor.getColumnIndex(NoteColumns.TITLE));
48 | String status = mCursor.getString(mCursor.getColumnIndex(NoteColumns.STATUS));
49 |
50 | int statusIcon = 0;
51 | switch (status){
52 | case NoteColumns.STATUS_DELETE:
53 | case NoteColumns.STATUS_NEW:
54 | case NoteColumns.STATUS_UPDATE:
55 | statusIcon = R.drawable.ic_cloud_upload_24dp;
56 | break;
57 | }
58 |
59 | holder.note.setText(title);
60 | holder.note.setCompoundDrawablesWithIntrinsicBounds(0, 0, statusIcon, 0);
61 | }
62 |
63 | @Override
64 | public int getItemCount() {
65 | return mCursor!=null?mCursor.getCount():0;
66 | }
67 |
68 | public void changeCursor(Cursor cursor) {
69 | Cursor old = swapCursor(cursor);
70 | if (old != null) {
71 | old.close();
72 | }
73 | }
74 |
75 | public Cursor swapCursor(Cursor newCursor) {
76 | if (newCursor == mCursor) {
77 | return null;
78 | }
79 | final Cursor oldCursor = mCursor;
80 | mCursor = newCursor;
81 | notifyDataSetChanged();
82 | return oldCursor;
83 | }
84 |
85 | public Note getItem(int position) {
86 | mCursor.moveToPosition(position);
87 | return new Note(mCursor);
88 | }
89 |
90 | public void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
91 | mOnItemClickListener = onItemClickListener;
92 | }
93 |
94 | private void onItemHolderClick(RecyclerView.ViewHolder itemHolder){
95 | if (mOnItemClickListener != null) {
96 | mOnItemClickListener.onItemClick(null, itemHolder.itemView,
97 | itemHolder.getAdapterPosition(), itemHolder.getItemId());
98 | }
99 | }
100 |
101 | static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
102 | @Bind(R.id.note)
103 | TextView note;
104 |
105 | private NotesListAdapter mAdapter;
106 |
107 | ViewHolder(View v, NotesListAdapter adapter) {
108 | super(v);
109 | ButterKnife.bind(this, v);
110 | v.setOnClickListener(this);
111 | mAdapter = adapter;
112 | }
113 |
114 | @Override
115 | public void onClick(View v) {
116 | mAdapter.onItemHolderClick(this);
117 | }
118 | }
119 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/database/NoteColumns.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.database;
2 |
3 | import net.simonvt.schematic.annotation.AutoIncrement;
4 | import net.simonvt.schematic.annotation.Check;
5 | import net.simonvt.schematic.annotation.DataType;
6 | import net.simonvt.schematic.annotation.NotNull;
7 | import net.simonvt.schematic.annotation.PrimaryKey;
8 |
9 | import static net.simonvt.schematic.annotation.DataType.Type.INTEGER;
10 | import static net.simonvt.schematic.annotation.DataType.Type.TEXT;
11 |
12 | /**
13 | * Created by mklepp on 22/11/15.
14 | */
15 | public interface NoteColumns {
16 |
17 | String STATUS_NEW = "new";
18 | String STATUS_DELETE = "delete";
19 | String STATUS_UPDATE = "update";
20 | String STATUS_DONE = "done";
21 |
22 | @DataType(INTEGER) @PrimaryKey @AutoIncrement String _ID = "_id";
23 |
24 | @DataType(TEXT) @NotNull String TITLE = "title";
25 | @DataType(TEXT) String CONTENT = "content";
26 |
27 | @DataType(TEXT)
28 | @Check(NoteColumns.STATUS + " in ('" + NoteColumns.STATUS_NEW + "', '"
29 | + NoteColumns.STATUS_UPDATE + "', '"
30 | + NoteColumns.STATUS_DELETE + "', '"
31 | + NoteColumns.STATUS_DONE + "')")
32 | String STATUS = "status";
33 |
34 | @DataType(INTEGER)
35 | String CREATION_DATE = "creation_date";
36 |
37 | @DataType(TEXT)
38 | String FILENAME = "filename";
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/database/NotesDatabase.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.database;
2 |
3 | import net.simonvt.schematic.annotation.Database;
4 | import net.simonvt.schematic.annotation.Table;
5 |
6 | /**
7 | * Created by mklepp on 22/11/15.
8 | */
9 | @Database(version = NotesDatabase.VERSION)
10 | public class NotesDatabase {
11 | public static final int VERSION = 1;
12 |
13 | @Table(NoteColumns.class) public static final String NOTES = "notes";
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/database/NotesProvider.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.database;
2 |
3 | import android.net.Uri;
4 |
5 | import net.simonvt.schematic.annotation.ContentProvider;
6 | import net.simonvt.schematic.annotation.ContentUri;
7 | import net.simonvt.schematic.annotation.InexactContentUri;
8 | import net.simonvt.schematic.annotation.TableEndpoint;
9 |
10 | import org.aykit.MyOwnNotes.BuildConfig;
11 |
12 | /**
13 | * Created by mklepp on 22/11/15.
14 | */
15 | @ContentProvider(authority = NotesProvider.AUTHORITY, database = NotesDatabase.class)
16 | public final class NotesProvider {
17 |
18 | public static final String AUTHORITY = BuildConfig.APPLICATION_ID+".NotesProvider";
19 | static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);
20 |
21 |
22 | private static Uri buildUri(String... paths) {
23 | Uri.Builder builder = BASE_CONTENT_URI.buildUpon();
24 | for (String path : paths) {
25 | builder.appendPath(path);
26 | }
27 | return builder.build();
28 | }
29 |
30 | @TableEndpoint(table = NotesDatabase.NOTES)
31 | public static class NOTES {
32 |
33 | @ContentUri(
34 | path = NotesDatabase.NOTES,
35 | type = "vnd.android.cursor.dir/list",
36 | defaultSort = NoteColumns.TITLE + " ASC")
37 | public static final Uri CONTENT_URI = buildUri(NotesDatabase.NOTES);
38 |
39 | @InexactContentUri(
40 | name = "NOTE_ID",
41 | path = NotesDatabase.NOTES + "/#",
42 | type = "vnd.android.cursor.item/note",
43 | whereColumn = NoteColumns._ID,
44 | pathSegment = 1)
45 | public static Uri withId(long id) {
46 | return buildUri(NotesDatabase.NOTES, String.valueOf(id));
47 | }
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/database/model/Note.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.database.model;
2 |
3 | import android.content.ContentValues;
4 | import android.database.Cursor;
5 | import android.os.Parcel;
6 | import android.os.Parcelable;
7 | import android.text.TextUtils;
8 |
9 | import org.aykit.MyOwnNotes.database.NoteColumns;
10 |
11 | /**
12 | * Created by mklepp on 22/11/15.
13 | */
14 | public class Note implements Parcelable {
15 | public long id;
16 | public String title;
17 | public String content;
18 | public int creationDate;
19 | String status;
20 | public String filename;
21 |
22 | public static final String NEW_TITLE = "new";
23 |
24 | public Note(){
25 | this.title = NEW_TITLE;
26 | this.status = NoteColumns.STATUS_NEW;
27 | this.creationDate = (int)(System.currentTimeMillis()/1000L);
28 | }
29 |
30 | public Note(Cursor cursor){
31 | id = cursor.getLong(cursor.getColumnIndex(NoteColumns._ID));
32 | title = cursor.getString(cursor.getColumnIndex(NoteColumns.TITLE));
33 | content = cursor.getString(cursor.getColumnIndex(NoteColumns.CONTENT));
34 | status = cursor.getString(cursor.getColumnIndex(NoteColumns.STATUS));
35 | filename = cursor.getString(cursor.getColumnIndex(NoteColumns.FILENAME));
36 | if (TextUtils.isEmpty(filename) || status.equals(NoteColumns.STATUS_NEW)){
37 | // Allow ascii-only filename and remove slashes
38 | filename = title.replaceAll("[^\\x00-\\x7F]", "").replaceAll("[/\\\\]", "")+".txt";
39 | }
40 | }
41 |
42 | protected Note(Parcel in) {
43 | id = in.readLong();
44 | title = in.readString();
45 | content = in.readString();
46 | status = in.readString();
47 | creationDate = in.readInt();
48 | filename = in.readString();
49 | }
50 |
51 | @Override
52 | public void writeToParcel(Parcel dest, int flags) {
53 | dest.writeLong(id);
54 | dest.writeString(title);
55 | dest.writeString(content);
56 | dest.writeString(status);
57 | dest.writeInt(creationDate);
58 | dest.writeString(filename);
59 | }
60 |
61 | public static final Creator CREATOR = new Creator() {
62 | @Override
63 | public Note createFromParcel(Parcel in) {
64 | return new Note(in);
65 | }
66 |
67 | @Override
68 | public Note[] newArray(int size) {
69 | return new Note[size];
70 | }
71 | };
72 |
73 | @Override
74 | public int describeContents() {
75 | return 0;
76 | }
77 |
78 | public ContentValues getContentValues() {
79 | ContentValues cv = new ContentValues();
80 | if (id > 0) {
81 | cv.put(NoteColumns._ID, id);
82 | }
83 | cv.put(NoteColumns.STATUS, status);
84 | cv.put(NoteColumns.TITLE, title);
85 | if (!TextUtils.isEmpty(content)) {
86 | cv.put(NoteColumns.CONTENT, content);
87 | }
88 | cv.put(NoteColumns.CREATION_DATE, creationDate);
89 | cv.put(NoteColumns.FILENAME, filename);
90 | return cv;
91 | }
92 |
93 | public void setEdited(){
94 | if (NoteColumns.STATUS_DONE.equals(status)){
95 | status = NoteColumns.STATUS_UPDATE;
96 | }
97 | }
98 |
99 | public void setDeleted() {
100 | status = NoteColumns.STATUS_DELETE;
101 | }
102 |
103 | public void setUploaded() {
104 | status = NoteColumns.STATUS_DONE;
105 | }
106 |
107 | public boolean isEdited() {
108 | return status.equals(NoteColumns.STATUS_UPDATE);
109 | }
110 |
111 | public boolean isDone() {
112 | return status.equals(NoteColumns.STATUS_DONE);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/fragments/NoteDetailFragment.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.fragments;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.support.v4.app.Fragment;
8 | import android.support.v7.widget.Toolbar;
9 | import android.text.Editable;
10 | import android.text.TextWatcher;
11 | import android.view.LayoutInflater;
12 | import android.view.Menu;
13 | import android.view.MenuInflater;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.EditText;
18 |
19 | import com.afollestad.materialdialogs.DialogAction;
20 | import com.afollestad.materialdialogs.MaterialDialog;
21 |
22 | import org.aykit.MyOwnNotes.R;
23 | import org.aykit.MyOwnNotes.activities.NoteDetailActivity;
24 | import org.aykit.MyOwnNotes.activities.NoteListActivity;
25 | import org.aykit.MyOwnNotes.database.NotesProvider;
26 | import org.aykit.MyOwnNotes.database.model.Note;
27 |
28 | import butterknife.Bind;
29 | import butterknife.ButterKnife;
30 |
31 | /**
32 | * A fragment representing a single Note detail screen.
33 | * This fragment is either contained in a {@link NoteListActivity}
34 | * in two-pane mode (on tablets) or a {@link NoteDetailActivity}
35 | * on handsets.
36 | */
37 | public class NoteDetailFragment extends Fragment implements TextWatcher {
38 | /**
39 | * The fragment argument representing the item ID that this fragment
40 | * represents.
41 | */
42 | public static final String ARG_NOTE = "note";
43 |
44 | private Note mNote;
45 |
46 | @Bind(R.id.title)
47 | EditText titleView;
48 |
49 | @Bind(R.id.content)
50 | EditText contentView;
51 |
52 | /**
53 | * Mandatory empty constructor for the fragment manager to instantiate the
54 | * fragment (e.g. upon screen orientation changes).
55 | */
56 | public NoteDetailFragment() {
57 | }
58 |
59 | @Override
60 | public void onCreate(Bundle savedInstanceState) {
61 | super.onCreate(savedInstanceState);
62 |
63 | Bundle args = getArguments();
64 | if (args.containsKey(ARG_NOTE)) {
65 |
66 | mNote = args.getParcelable(ARG_NOTE);
67 |
68 | Activity activity = this.getActivity();
69 | Toolbar appBarLayout = (Toolbar) activity.findViewById(R.id.toolbar);
70 | if (appBarLayout != null) {
71 | appBarLayout.setTitle(mNote.title);
72 | }
73 | }
74 |
75 | setHasOptionsMenu(true);
76 | }
77 |
78 | @Override
79 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
80 | Bundle savedInstanceState) {
81 | return inflater.inflate(R.layout.fragment_note_detail, container, false);
82 | }
83 |
84 | @Override
85 | public void onViewCreated(View view, Bundle savedInstanceState) {
86 | super.onViewCreated(view, savedInstanceState);
87 | ButterKnife.bind(this, view);
88 |
89 | titleView.setText(mNote.title);
90 | if (mNote.title.equals(Note.NEW_TITLE)) {
91 | titleView.setSelection(0, mNote.title.length());
92 | } else {
93 | titleView.setSelection(mNote.title.length());
94 | }
95 | titleView.addTextChangedListener(this);
96 | contentView.setText(mNote.content);
97 | contentView.addTextChangedListener(this);
98 | }
99 |
100 | @Override
101 | public void onDestroyView() {
102 | ButterKnife.unbind(this);
103 | super.onDestroyView();
104 | }
105 |
106 | @Override
107 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
108 | inflater.inflate(R.menu.note_detail, menu);
109 | super.onCreateOptionsMenu(menu, inflater);
110 | }
111 |
112 | @Override
113 | public boolean onOptionsItemSelected(MenuItem item) {
114 | int id = item.getItemId();
115 | if (id == R.id.delete_note) {
116 | if (isAdded()) {
117 | new MaterialDialog.Builder(getActivity())
118 | .title(R.string.dialog_delete_title)
119 | .content(mNote.title)
120 | .positiveText(android.R.string.yes)
121 | .onPositive(new MaterialDialog.SingleButtonCallback() {
122 | @Override
123 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
124 | new Thread(new Runnable() {
125 | @Override
126 | public void run() {
127 | mNote.setDeleted();
128 | getActivity().getContentResolver().update(NotesProvider.NOTES.withId(mNote.id), mNote.getContentValues(), null, null);
129 | }
130 | }).start();
131 |
132 | // close detailview
133 | getActivity().navigateUpTo(new Intent(getActivity(), NoteListActivity.class));
134 | }
135 | })
136 | .negativeText(android.R.string.no)
137 | .show();
138 | }
139 |
140 | return true;
141 | }
142 | return super.onOptionsItemSelected(item);
143 | }
144 |
145 | @Override
146 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
147 |
148 | }
149 |
150 | @Override
151 | public void onTextChanged(CharSequence s, int start, int before, int count) {
152 |
153 | }
154 |
155 | @Override
156 | public void afterTextChanged(Editable s) {
157 | mNote.title = titleView.getText().toString();
158 | mNote.content = contentView.getText().toString();
159 | final Context appContext = getActivity().getApplicationContext();
160 | new Thread(new Runnable() {
161 | @Override
162 | public void run() {
163 | mNote.setEdited();
164 | appContext.getContentResolver().update(NotesProvider.NOTES.withId(mNote.id), mNote.getContentValues(), null, null);
165 | }
166 | }).start();
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/fragments/NoteListFragment.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.fragments;
2 |
3 | import android.app.Activity;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.IntentFilter;
8 | import android.database.Cursor;
9 | import android.graphics.Bitmap;
10 | import android.graphics.Canvas;
11 | import android.graphics.Paint;
12 | import android.graphics.drawable.BitmapDrawable;
13 | import android.graphics.drawable.Drawable;
14 | import android.os.Bundle;
15 | import android.support.v4.app.Fragment;
16 | import android.support.v4.app.LoaderManager;
17 | import android.support.v4.content.CursorLoader;
18 | import android.support.v4.content.Loader;
19 | import android.support.v4.content.LocalBroadcastManager;
20 | import android.support.v4.widget.SwipeRefreshLayout;
21 | import android.support.v7.widget.LinearLayoutManager;
22 | import android.support.v7.widget.RecyclerView;
23 | import android.support.v7.widget.helper.ItemTouchHelper;
24 | import android.view.LayoutInflater;
25 | import android.view.View;
26 | import android.view.ViewGroup;
27 | import android.widget.AdapterView;
28 | import android.widget.TextView;
29 |
30 | import org.aykit.MyOwnNotes.R;
31 | import org.aykit.MyOwnNotes.adapter.DividerItemDecoration;
32 | import org.aykit.MyOwnNotes.adapter.NotesListAdapter;
33 | import org.aykit.MyOwnNotes.asynctasks.SyncNotesAsyncTask;
34 | import org.aykit.MyOwnNotes.database.NoteColumns;
35 | import org.aykit.MyOwnNotes.database.NotesProvider;
36 | import org.aykit.MyOwnNotes.database.model.Note;
37 |
38 | import butterknife.Bind;
39 | import butterknife.ButterKnife;
40 |
41 | /**
42 | * A list fragment representing a list of Notes. This fragment
43 | * also supports tablet devices by allowing list items to be given an
44 | * 'activated' state upon selection. This helps indicate which item is
45 | * currently being viewed in a {@link NoteDetailFragment}.
46 | *
47 | * Activities containing this fragment MUST implement the {@link Callbacks}
48 | * interface.
49 | */
50 | public class NoteListFragment extends Fragment implements LoaderManager.LoaderCallbacks, AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener {
51 |
52 | private NotesListAdapter adapter;
53 |
54 | private static final int LOADER_NOTES = 20;
55 |
56 | @Bind(android.R.id.list)
57 | RecyclerView recyclerView;
58 |
59 | @Bind(android.R.id.empty)
60 | TextView emptyView;
61 |
62 | @Bind(R.id.swipeContainer)
63 | SwipeRefreshLayout swipeRefreshLayout;
64 |
65 | Bitmap trashIcon;
66 |
67 | private BroadcastReceiver syncBroadcastReceiver = new BroadcastReceiver() {
68 | @Override
69 | public void onReceive(Context context, Intent intent) {
70 | switch (intent.getAction()) {
71 | case SyncNotesAsyncTask.SYNC_FINISHED:
72 | swipeRefreshLayout.setRefreshing(false);
73 | break;
74 | case SyncNotesAsyncTask.SYNC_PROGRESS:
75 | break;
76 | }
77 | }
78 | };
79 |
80 | /**
81 | * The serialization (saved instance state) Bundle key representing the
82 | * activated item position. Only used on tablets.
83 | */
84 | private static final String STATE_ACTIVATED_POSITION = "activated_position";
85 |
86 | /**
87 | * The fragment's current callback object, which is notified of list item
88 | * clicks.
89 | */
90 | private Callbacks mCallbacks = sDummyCallbacks;
91 |
92 | @Override
93 | public void onRefresh() {
94 | SyncNotesAsyncTask.start(getActivity());
95 | }
96 |
97 | /**
98 | * A callback interface that all activities containing this fragment must
99 | * implement. This mechanism allows activities to be notified of item
100 | * selections.
101 | */
102 | public interface Callbacks {
103 | /**
104 | * Callback for when an item has been selected.
105 | */
106 | void onNoteSelected(Note note);
107 | void onNoteSwiped(Note note);
108 | }
109 |
110 | /**
111 | * A dummy implementation of the {@link Callbacks} interface that does
112 | * nothing. Used only when this fragment is not attached to an activity.
113 | */
114 | private static Callbacks sDummyCallbacks = new Callbacks() {
115 |
116 | @Override
117 | public void onNoteSelected(Note note) {
118 | }
119 |
120 | @Override
121 | public void onNoteSwiped(Note note) {
122 |
123 | }
124 | };
125 |
126 | /**
127 | * Mandatory empty constructor for the fragment manager to instantiate the
128 | * fragment (e.g. upon screen orientation changes).
129 | */
130 | public NoteListFragment() {
131 | }
132 |
133 | @Override
134 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
135 | Bundle savedInstanceState) {
136 | return inflater.inflate(R.layout.fragment_note_list, container, false);
137 | }
138 |
139 | @Override
140 | public void onViewCreated(final View view, Bundle savedInstanceState) {
141 | super.onViewCreated(view, savedInstanceState);
142 | ButterKnife.bind(this, view);
143 |
144 | trashIcon = drawableToBitmap(getResources().getDrawable(R.drawable.ic_delete_24dp));
145 |
146 | if (adapter != null) {
147 | recyclerView.setAdapter(adapter);
148 | }
149 | recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
150 |
151 | RecyclerView.ItemDecoration itemDecoration = new
152 | DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL_LIST);
153 | recyclerView.addItemDecoration(itemDecoration);
154 |
155 | swipeRefreshLayout.setOnRefreshListener(this);
156 | swipeRefreshLayout.setColorSchemeResources(R.color.accent, R.color.primary);
157 |
158 | ItemTouchHelper helper = new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0,
159 | ItemTouchHelper.START) {
160 |
161 | @Override
162 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
163 | return false;
164 | }
165 |
166 | @Override
167 | public void onSwiped(final RecyclerView.ViewHolder viewHolder, int direction) {
168 | Note note = adapter.getItem(viewHolder.getAdapterPosition());
169 | mCallbacks.onNoteSwiped(note);
170 |
171 | // reset state
172 | adapter.notifyItemChanged(viewHolder.getAdapterPosition());
173 | }
174 |
175 | @Override
176 | public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
177 | if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
178 | // Get RecyclerView item from the ViewHolder
179 | View itemView = viewHolder.itemView;
180 |
181 | Paint p = new Paint();
182 |
183 | p.setColor(getResources().getColor(R.color.colorAccent));
184 |
185 | c.drawRect((float) itemView.getRight() + dX, (float) itemView.getTop(),
186 | (float) itemView.getRight(), (float) itemView.getBottom(), p);
187 |
188 | c.drawBitmap(trashIcon,
189 | Math.max((float) itemView.getRight() - itemView.getPaddingRight() - trashIcon.getWidth(), itemView.getRight() + dX),
190 | (float) itemView.getTop() + ((float) itemView.getBottom() - (float) itemView.getTop() - trashIcon.getHeight()) / 2,
191 | new Paint());
192 |
193 |
194 | float width = (float) viewHolder.itemView.getWidth();
195 | float alpha = 1.0f - Math.abs(dX) / width;
196 | viewHolder.itemView.setAlpha(alpha);
197 | viewHolder.itemView.setTranslationX(dX);
198 | }
199 |
200 | }
201 | });
202 | helper.attachToRecyclerView(recyclerView);
203 |
204 | getLoaderManager().initLoader(LOADER_NOTES, null, this);
205 | }
206 |
207 | @Override
208 | public void onDestroyView() {
209 | ButterKnife.unbind(this);
210 | super.onDestroyView();
211 | }
212 |
213 | @Override
214 | public void onAttach(Activity activity) {
215 | super.onAttach(activity);
216 |
217 | // Activities containing this fragment must implement its callbacks.
218 | if (!(activity instanceof Callbacks)) {
219 | throw new IllegalStateException("Activity must implement fragment's callbacks.");
220 | }
221 |
222 | mCallbacks = (Callbacks) activity;
223 | }
224 |
225 | @Override
226 | public void onDetach() {
227 | super.onDetach();
228 |
229 | // Reset the active callbacks interface to the dummy implementation.
230 | mCallbacks = sDummyCallbacks;
231 | }
232 |
233 | // @Override
234 | // public void onSaveInstanceState(Bundle outState) {
235 | // super.onSaveInstanceState(outState);
236 | // if (mActivatedPosition != ListView.INVALID_POSITION) {
237 | // // Serialize and persist the activated item position.
238 | // outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
239 | // }
240 | // }
241 |
242 | @Override
243 | public Loader onCreateLoader(int id, Bundle args) {
244 | String select = NoteColumns.STATUS + "<>?";
245 | String[] selectArgs = new String[]{NoteColumns.STATUS_DELETE};
246 | String sortOrder = NoteColumns.CREATION_DATE+" ASC";
247 | return new CursorLoader(getActivity(), NotesProvider.NOTES.CONTENT_URI, null, select, selectArgs, sortOrder);
248 | }
249 |
250 | @Override
251 | public void onLoadFinished(Loader loader, Cursor data) {
252 | if (adapter == null) {
253 | adapter = new NotesListAdapter(data);
254 | adapter.setOnItemClickListener(this);
255 | recyclerView.setAdapter(adapter);
256 | } else {
257 | adapter.changeCursor(data);
258 | }
259 |
260 | if (data != null && data.getCount() > 0) {
261 | emptyView.animate().alpha(0);
262 | } else {
263 | emptyView.animate().alpha(1);
264 | }
265 | }
266 |
267 | @Override
268 | public void onLoaderReset(Loader loader) {
269 | if (adapter != null) {
270 | adapter.changeCursor(null);
271 | }
272 | }
273 |
274 | @Override
275 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
276 | Note note = adapter.getItem(position);
277 | mCallbacks.onNoteSelected(note);
278 | }
279 |
280 | @Override
281 | public void onResume() {
282 | super.onResume();
283 |
284 | IntentFilter filter = new IntentFilter();
285 | filter.addAction(SyncNotesAsyncTask.SYNC_PROGRESS);
286 | filter.addAction(SyncNotesAsyncTask.SYNC_FINISHED);
287 |
288 | LocalBroadcastManager.getInstance(getActivity()).registerReceiver(syncBroadcastReceiver, filter);
289 | }
290 |
291 | @Override
292 | public void onPause() {
293 | super.onPause();
294 |
295 | LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(syncBroadcastReceiver);
296 |
297 | }
298 |
299 | public static Bitmap drawableToBitmap (Drawable drawable) {
300 | Bitmap bitmap = null;
301 |
302 | if (drawable instanceof BitmapDrawable) {
303 | BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
304 | if(bitmapDrawable.getBitmap() != null) {
305 | return bitmapDrawable.getBitmap();
306 | }
307 | }
308 |
309 | if(drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
310 | bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel
311 | } else {
312 | bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
313 | }
314 |
315 | Canvas canvas = new Canvas(bitmap);
316 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
317 | drawable.draw(canvas);
318 | return bitmap;
319 | }
320 | }
321 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/helpers/LegacyImporter.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.helpers;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.database.sqlite.SQLiteDatabase;
6 |
7 | import org.aykit.MyOwnNotes.database.model.Note;
8 |
9 | import java.io.File;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by mklepp on 21/02/16.
15 | */
16 | public class LegacyImporter {
17 |
18 | static final String LEGACY_DB_NAME = "notes.db";
19 |
20 | private Context mContext;
21 |
22 | public LegacyImporter(Context context) {
23 | this.mContext = context;
24 | }
25 |
26 | private File getDatabasePath(){
27 | return mContext.getDatabasePath(LEGACY_DB_NAME);
28 | }
29 |
30 | public boolean checkForMigration(){
31 | File oldDb = getDatabasePath();
32 |
33 | if (oldDb.exists()){
34 | return true;
35 | }
36 |
37 | return false;
38 | }
39 |
40 | public List extractNotes(){
41 |
42 | List extractedNotes = new ArrayList<>();
43 |
44 | SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(getDatabasePath(), null);
45 |
46 | Cursor cursor = db.rawQuery("SELECT * FROM notes WHERE noteStatus IS NOT NULL", null);
47 |
48 | if (cursor!=null)
49 | {
50 | while(cursor.moveToNext()){
51 | Note note = new Note();
52 | note.title = "Unsynchronized Note from previous version";
53 | note.content = cursor.getString(cursor.getColumnIndex("content"));
54 |
55 | extractedNotes.add(note);
56 | }
57 |
58 | // close and delete old database
59 | db.close();
60 | getDatabasePath().delete();
61 | } else {
62 | db.close();
63 | }
64 |
65 | return extractedNotes;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/org/aykit/MyOwnNotes/helpers/Settings.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes.helpers;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 | import android.preference.PreferenceManager;
6 |
7 | import com.owncloud.android.lib.common.OwnCloudClient;
8 | import com.owncloud.android.lib.common.operations.RemoteOperationResult;
9 | import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation;
10 | import com.owncloud.android.lib.resources.files.FileUtils;
11 | import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
12 |
13 | import org.aykit.MyOwnNotes.database.generated.NotesDatabase;
14 |
15 | /**
16 | * Created by mklepp on 26/11/15.
17 | */
18 | public class Settings {
19 | public static final String PREF_ACCOUNT_NAME = "PREF_ACCOUNT_NAME";
20 | public static final String PREF_ACCOUNT_PASSWORD = "PREF_ACCOUNT_PASSWORD";
21 |
22 | public static final String NOTE_PATH_DEFAULT = "Notes";
23 |
24 | public static Uri getAccountURL(String accountname){
25 | String[] credentials = accountname.split("@");
26 | if (credentials.length != 2) {
27 | return null;
28 | }
29 | return Uri.parse("https://"+credentials[1]);
30 | }
31 |
32 | public static String getAccountUsername(String accountName){
33 | String[] credentials = accountName.split("@");
34 | if (credentials.length != 2) {
35 | return null;
36 | }
37 | return credentials[0];
38 | }
39 |
40 | public static boolean checkRemoteAccess(OwnCloudClient client) {
41 | ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(FileUtils.PATH_SEPARATOR);
42 | RemoteOperationResult result = refreshOperation.execute(client);
43 |
44 | return result.isSuccess();
45 | }
46 |
47 | // if notes folder does'nt exist, create him
48 | public static boolean checkRemoteFolder(OwnCloudClient client) {
49 |
50 | ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(Settings.NOTE_PATH_DEFAULT);
51 | RemoteOperationResult result = refreshOperation.execute(client);
52 |
53 | if (!result.isSuccess()) {
54 | CreateRemoteFolderOperation createOperation = new CreateRemoteFolderOperation(Settings.NOTE_PATH_DEFAULT, true);
55 | RemoteOperationResult createResult = createOperation.execute(client);
56 | if (createResult.isSuccess()) {
57 | return true;
58 | }
59 | } else {
60 | return true;
61 | }
62 |
63 | return false;
64 | }
65 |
66 | public static void clearApp(Context context) {
67 | // delete stored preferences - username/password
68 | PreferenceManager.getDefaultSharedPreferences(context).edit().clear().apply();
69 |
70 | // delete database
71 | clearDatabase(context);
72 | }
73 |
74 | public static void clearDatabase(Context context){
75 | NotesDatabase db = NotesDatabase.getInstance(context);
76 | // close before deleting
77 | db.close();
78 | // remove database file
79 | context.deleteDatabase(db.getDatabaseName());
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_cloud_upload_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_delete_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_exit_to_app_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-sw600dp/activity_note_list.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
17 |
18 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
22 |
23 |
24 |
25 |
30 |
31 |
39 |
40 |
44 |
45 |
54 |
55 |
62 |
63 |
64 |
65 |
66 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_note_app_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
20 |
21 |
26 |
27 |
28 |
29 |
35 |
36 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
58 |
59 |
60 |
61 |
62 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_note_detail.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_note_list.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawer_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
30 |
31 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_note_detail.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 |
23 |
24 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_note_list.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
13 |
14 |
18 |
19 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/row_note.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_nav.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/note_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #607D8B
4 | #455A64
5 | #CFD8DC
6 | #FFC107
7 | #212121
8 | #727272
9 | #FFFFFF
10 | #B6B6B6
11 |
12 | @color/primary
13 | @color/primary_dark
14 | @color/accent
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10dp
4 | 16dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/setup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | owncloud
4 | nextcloud
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Note title
4 | Note content
5 | delete
6 | There are no saved notes. You either did not create any or have not yet synched with your ownCloud.
7 | There was a connection error.
8 | Please check your username and password.
9 | Password:
10 | password
11 |
12 |
13 | The aykit logo
14 |
15 | This app is brought to you by aykit - an association supporting art, culture and science. \nMore information on our website: \n\nhttp://aykit.org
16 |
17 |
18 | All revenue will be spent to improve this app and do other great things to support internet freedom. If you have any suggestions or want to build this application yourself, visit us at https://github.com/aykit/myownnotes-android.
19 |
20 |
21 | logout
22 | Confirm logout
23 |
24 | Confirm delete
25 |
26 | List Owncloud accounts
27 | We need your permission to access your Owncloud account
28 | You need to grant this permission to use this app
29 |
30 | Add Account
31 | We use the accounts of the ownCloud or Nextcloud app. After adding the account there you will see it in this app.
32 | Open ownCloud
33 | Open Nextcloud
34 |
35 | Navigation opened
36 | Navigation closed
37 |
38 | No accounts found. Please add an account using a cloud app.
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/test/java/org/aykit/MyOwnNotes/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.aykit.MyOwnNotes;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | maven { url "https://jitpack.io" }
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aykit/MyOwnNotes/225efdb1f483df815ef467f2351747b82b786c54/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Dec 11 10:40:04 CET 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/myownnotes-android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 |
--------------------------------------------------------------------------------
/res/layout/activity_note_list.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
21 |
28 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/res/layout/activity_note_single.xml:
--------------------------------------------------------------------------------
1 |
12 |
17 |
18 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/res/layout/activity_note_single_textview.xml:
--------------------------------------------------------------------------------
1 |
12 |
17 |
18 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
12 |
17 |
18 |
19 |
26 |
27 |
33 |
41 |
42 |
48 |
56 |
57 |
63 |
71 |
72 |
73 |
80 |
87 |
88 |
89 |
96 |
103 |
104 |
105 |
106 |
112 |
113 |
114 |
121 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/res/layout/note_listview_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
26 |
27 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Einstellungen
7 | Hallo Welt!
8 | Einstellungen
9 | MyOwnNotes
10 | Notiz
11 | Info
12 | Hilfe
13 |
14 |
15 | Notiztitel
16 | Notizinhalt
17 | speichern
18 | löschen
19 | Notiz erfolgreich gespeichert
20 | Test
21 | Notiz speichern
22 | Notiz löschen
23 |
24 | Neue Notiz gespeichert
25 | Änderungen gespeichert
26 | Notiz gelöscht
27 | Notiz als zu löschen markiert
28 |
29 |
30 | Neue Notiz erstellen
31 | synchronisieren
32 | Info
33 | Hilfe
34 | Keine gespeicherten Notizen vorhanden. Sie haben entweder noch keine erstellt oder Ihre Notizen noch nicht mit ownCloud synchronisiert.
35 | Anscheinend wollen Sie auf einen Server zugreifen, der ein selbst signiertes Zertifikat verwendet. Um diese Verbindung aufbauen zu können, müssen Sie das Zertifikat des Servers manuell dem Android Schlüsselbund hinzufügen. \n\nMöchten Sie jetzt die Anleitung dazu lesen?
36 | Ja
37 | Nein
38 |
39 | Kein gültiges JSON Format vom Server bekommen. Server OK?
40 | Die URL, von der Daten abgefragt werden, ist nicht formgerecht
41 | Die URL, von der Daten abgefragt werden, scheint nicht zu existieren. Bitte Schreibweise und Internet-Verbindung überprüfen.
42 | Es gab einen Verbindungs-Fehler.
43 | Bitte überprüfen Sie Ihren Benutzernamen und Ihr Passwort.
44 | Es wurde keine Internet-Verbindung gefunden. Bitte verbinden Sie ihr Gerät mit dem Internet, um zu synchronisieren.
45 | Synchronisation wird durchgeführt
46 |
47 |
48 | Berechtigungsdaten:
49 | Server-Adresse:
50 | https://www.server.com[:port]
51 | https://
52 | Benutzername:
53 | Benutzername
54 | Passwort:
55 | Passwort
56 | Synchronisierung
57 | Automatische Synchronisierung
58 | Standard Notiztitel
59 | Datum und Uhrzeit
60 | Einstellungen gespeichert
61 | Fehlersuche
62 | Umfangreiche LogCat Nachrichten aktivieren
63 |
64 |
65 | Bitte geben Sie Ihren Benutzernamen ein
66 | Bitte geben Sie Ihr Passwort ein
67 | Bitte geben Sie eine gültige URL an. Diese muss mit \"https://\" beginnen.
68 |
69 |
70 | Das aykit Logo
71 | Diese App wurde von Aykit - Verein zur Förderung von Kunst, Kultur und Wissenschaft – erstellt. \nMehr Informationen auf unserer Website: \n\nhttp://aykit.org
72 |
73 |
74 |
75 | Welche URL soll ich eingeben?\n
76 | Bitte geben Sie die URL zum Quellverzeichnis der ownCloud-Installation an. Das ist dieselbe URL, mit der Sie auf Ihre ownCloud per Browser zugreifen. \n(z.B.: https://meineowncloud.com)
77 | \n\n
78 | Kann ich über diese App auf meine ownCloud auch via http und nicht per https zugreifen?\n
79 | Nein, das ist nicht möglich. Die Notes-API verlangt, dass Benutzername und Password für jede Verbindung mitgeschickt werden muss. Würde man http verwenden, würden diese essenziellen Daten in Plain-Text übertragen werden. Keine gute Idee! \n(Warum? Lesen Sie das: "Man-in-the-middle"-Attacke http://de.wikipedia.org/wiki/Man-in-the-middle-Angriff)
80 | \n\n
81 | Ich habe einen ownCloud-Server, der ein selbst signiertes Zertifikat verwendet. Kann ich diese App für meinen Server verwenden?\n
82 | Ja, können Sie – aber nicht einfach so. Sie müssen Android vorher zuerst explizit mitteilen, dass es Ihr selbst signiertes Zertifikat akzeptieren soll. Das geschieht, in dem man das Zertifikat manuell zu Androids Schlüsselbund hinzufügt.
83 | \nFolgen Sie dieser Anleitung, wie man das macht: http://aykit.org/sites/myownnotes.html
84 |
85 |
86 |
87 | zu löschen
88 | neue Notiz
89 | zu aktualisieren
90 |
91 |
92 |
--------------------------------------------------------------------------------
/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Ajustes
7 | ¡Hola, Mundo!
8 | Ajustes
9 | MyOwnNotes
10 | Nota
11 | Acerca
12 | Ayuda
13 |
14 |
15 | Título de la nota
16 | Contenido de la nota
17 | guardar
18 | borrar
19 | Se ha guardado la nota
20 | test
21 | Guardar nota
22 | Borrar nota
23 |
24 | Nueva nota guardada
25 | Cambios guardados
26 | Nota borrada
27 | Nota marcada para eliminación
28 |
29 |
30 | Crear nueva nota
31 | Sincronizar
32 | Acerca
33 | Ayuda
34 | No hay notas guardadas. No has creado ninguna o aún no has sincronizado con tu ownCloud.
35 | Parece que estás intentando conectar con a un servidor que usa un certificado autofirmado. Para este tipo de conexión, tienes que añadir manualmente el certificado en el Almacenamiento de Credenciales.\n\n¿Quieres ver un tutorial para ver como hacer esto?
36 | Sí
37 | No, gracias
38 |
39 | No obtengo JSON correcto desde el servidor. ¿Está bien el servidor?
40 | La URL insertada no es correcta
41 | La URL que especificaste no parece existir. Asegurarte de haberla escrito bien o comprueba tu conexión
42 | Hubo un error de conexión. Por favor comprueba tu usuario y contraseña
43 | Please check your username and password.
44 | No internet-connection has been found. Please connect to the internet to synchronize.
45 | Sync in progress
46 |
47 |
48 | Credenciales:
49 | Dirección del servidor:
50 | www.tuowncloud.com
51 | https://
52 | Usuario:
53 | usuario
54 | Contraseña:
55 | contraseña
56 | Sincronización
57 | Sincronización automática
58 | Título de la nota por defecto
59 | Fecha y hora
60 | Ajustes guardados
61 | Debug
62 | Enable extensive LogCat output
63 |
64 |
65 | Por favor, introduce el usuario de tu cuenta ownCloud
66 | Por favor, introduce la contraseña de tu cuenta ownCloud
67 | Por favor, introduce una URL válida. Debe empezar por \"https://\"
68 |
69 |
70 | Logo de aykit
71 |
72 | aykit es el proveedor de esta aplicación - una asociación que da soporta al arte, la cultura y la ciencia.\nMás información en la pagina: \n\nhttp://aykit.org
73 |
74 |
75 |
76 |
77 | ¿Qué URL tengo que poner?\n
78 | Pon la URL raíz de tu instalación de ownCloud. Es decir, la misma URL que usas para conectarte a tu ownCloud con el navegador.\n(ej: https://miowncloud.com)
79 | \n\n
80 | ¿Puedo usar esta app para conectarme a mi ownCloud por http y no por https?\n
81 | No, no es posible. La Notes-API requiere enviar usuario y contraseña en cada conexión. Si usaras http, enviarías información vital en claro. ¡No es una buena idea!\n(¿Que por qué? Lee esto: "Ataque Man-in-the-middle" http://es.wikipedia.org/wiki/Ataque_Man-in-the-middle)
82 | \n\n
83 | Tengo un servidor ownCloud con un certificado autofirmado. ¿Puedo usar esta app con mi servidor?\n
84 | Sí, puedes, tras añadir el certificado a tu dispositivo. Tienes que configurar Android para aceptar certificados autofirmados añadendo manualmente el certificado en el Administrador de Credenciales de Android.
85 | \nSigue este tutorial para conseguirlo: http://aykit.org/sites/myownnotes.html
86 |
87 |
88 |
89 | para borrar
90 | nueva nota
91 | para actualizar
92 |
93 |
94 |
--------------------------------------------------------------------------------
/res/values-eu/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Ajustes
7 | Hola Mundo!
8 | Ajustes
9 | MyOwnNotes
10 | Nota
11 | Acerca
12 | Ayuda
13 |
14 |
15 | Titulo Nota
16 | Contenido Nota
17 | guardar
18 | borrar
19 | Se ha guardado la nota
20 | test
21 | Guardar nota
22 | Borrar nota
23 |
24 | Nueva nota guardada
25 | Cambios guardados
26 | Nota borrada
27 | Nota marcada para eliminación
28 |
29 |
30 | Crear nueva nota
31 | Sincronizar
32 | Acerca
33 | Ayuda
34 | No hay notas guardadas. No has creado ninguna o aún no has sincronizado con tu ownCloud.
35 | Parece que estás intentando conectar a un servidor que utiliza un certificado autofirmado. Para este tipo de conexión, tienes que añadir manualmente el certificado en el Almacenamiento de Credenciales. \n\n¿Quieres ver una tutoría para ver como hacer esto?
36 | Si
37 | No, gracias
38 |
39 | No obtengo JSON correcto desde el servidor. ¿Está bien el servidor?
40 | La URL insertada no es correcta
41 | La URL que especificaste no parece existir. Asegúrate de haberla escrito bien, o comprueba tu conexión.
42 | Hubo un error de conexión.
43 | Por favor comprueba tu usuario y contraseña.
44 | TO TRANSLATE: No internet-connection has been found. Please connect to the internet to synchronize.
45 | TO TRANSLATE: Sync in progress
46 |
47 |
48 |
49 | Credenciales:
50 | Dirección-servidor:
51 | https://www.server.com[:port]
52 | https://
53 | Usuario:
54 | usuario
55 | Contraseña:
56 | contraseña
57 | Sincronización
58 | Auto sincronización
59 | Nombre de nota por defecto
60 | Fecha y hora
61 | Ajustes guardados
62 | depurar
63 | Activar mensajes extensos Logcat
64 |
65 |
66 | Por favor introduce el usuario de tu cuenta ownCloud
67 | Por favor introduce la contraseña de tu cuenta ownCloud
68 | Por favor, introduce una URL valida. Tiene que empezar con \"https://\"
69 |
70 |
71 | Logo de aykit
72 | aykit es el proveedor de esta aplicación - una asociación que da soporte al arte, cultura y ciencia. \nMás información en la página: \n\nhttp://aykit.org
73 |
74 |
75 |
76 | ¿Que URL tengo que poner?\n
77 | Poner la URL raíz de tu instalación de ownCloud - es decir: la misma URL que usas para conectarte a tu ownCloud con el navegador.\n(ej: https://miowncloud.com)
78 | \n\n
79 | ¿Puedo usar esta aplicación para conectarme a mi ownCloud por http y no por https?\n
80 | No, no es posible. La Notes-API requiere enviar usuario y contraseña en cada conexión. Si usaras http, enviarías información vital en claro. No es una buena idea! \n(¿Por qué? Lee eso: "Ataque Man-in-the-middle" http://es.wikipedia.org/wiki/Ataque_Man-in-the-middle)
81 | \n\n
82 | Tengo un servidor ownCloud con un certificado auto-firmado. ¿Puedo usar esta app para mi servidor?\n
83 | Si, puedes - tras añadir el certificado a tu dispositivo. Tienes que configurar Android para aceptar certificados autofirmados añadendo manualmente el certificado en el Administrador de Credenciales de Android.
84 | \nMira esta tutoría para conseguirlo: http://aykit.org/sites/myownnotes.html
85 |
86 |
87 |
88 | para Borrar
89 | nueva Nota
90 | para Actualizar
91 |
92 |
--------------------------------------------------------------------------------
/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Réglages
7 | Bonjour tout le monde !
8 | Réglages
9 | MyOwnNotes
10 | Note
11 | À propos de
12 | Aide
13 |
14 |
15 | Titre de la note
16 | Contenu de la note
17 | Enregistrer
18 | Supprimer
19 | La note a été enregistrée
20 | Test
21 | Enregistrer la note
22 | Supprimer la note
23 |
24 |
25 | Nouvelle note enregistrée
26 | Modifications enregistrées
27 | Note supprimée
28 | Note marquée comme supprimée
29 |
30 |
31 | Créer une note
32 | Synchroniser
33 | A propos de
34 | Aide
35 | Aucune note enregistrée. Vous n\'en avez pas créé ou elles ne sont pas encore synchronisées avec votre ownCloud.
36 | Vous essayez de vous connecter à un serveur qui utilise un certificat auto-signé. Vous devez ajouter manuellement ce certificat aux certificats de confiance d\'Android. \n\n Voulez-vous accéder au didacticiel ?
37 | Oui
38 | Non merci
39 |
40 | Pas de JSON correct reçu. Un problème sur le serveur ?
41 | L\'URL paramétrée est incorrecte.
42 | L\'URL paramétrée n\'existe pas. Vérifiez son exactitude ou votre connexion internet.
43 | Erreur de connexion.
44 | Vérifiez votre nom d\'utilisateur et votre mot de passe.
45 | Aucune connexion à Internet. Connectez-vous à Internet pour pouvoir synchroniser.
46 | Synchronisation en cours.
47 |
48 |
49 | Données de connexion :
50 | Adresse du serveur :
51 | https://www.server.com[:port]
52 | https://
53 | Nom d\'utilisateur :
54 | Le nom d\'utilisateur
55 | Mot de passe :
56 | Le mot de passe
57 | Synchronisation
58 | Synchronisation automatique
59 | Titre par défaut de la note
60 | Date et heure
61 | Paramètres enregistrés
62 | Debug/Afficher les erreurs
63 | Activer la sortie LogCat verbeuse
64 |
65 |
66 | Saisissez votre nom d\'utilisateur ownCloud, s\'il vous plaît.
67 | Saisissez votre mot de passe ownCloud, s\'il vous plaît.
68 | Saisissez l\'adresse du serveur. Elle doit commencer par \"https://\".
69 |
70 |
71 | Logo de aykit
72 | Cette application vous est présentée par aykit - une association qui soutient l\'art, la culture et la science. \nPlus d\'informations sur notre site : \n\nhttp://aykit.org
73 |
74 |
75 |
76 |
77 | Quelles URL dois-je saisir ? \n
78 | Saisir l\'URL à la racine de l\'installation ownCloud - c\'est la même URL que vous utilisez pour vous connecter à votre ownCloud via le navigateur \n (par exemple https://myowncloud.com)
79 | \n\n
80 | Puis-je utiliser cette application pour me connecter à mon ownCloud via http (sans https) ?
81 | \n
82 | Non, ce n\'est pas possible. La Notes-API exige à chaque connexion l\'envoi du nom d\'utilisateur et du mot de passe. Si vous utilisez http, vous envoyez ces informations vitales en clair. Ce n\'est pas vraiment une bonne idée !
83 | \n
84 | (Pourquoi ? Lire ceci : L\'attaque "Man-in-the-middle" http://fr.wikipedia.org/wiki/Attaque_de_l%27homme_du_milieu)
85 | \n\n
86 | J\'ai un serveur ownCloud avec un certificat auto-signé. Puis-je utiliser cette application pour mon serveur ?
87 | \n
88 | Oui, c\'est possible - voici comment : Vous devez indiquer expressément à Android d\'accepter votre certificat auto-signé. Ceci est fait en ajoutant manuellement le certificat au gestionnaire de clés d\'Android.
89 | \n
90 | Cf. ce tutoriel : http://aykit.org/sites/myownnotes.html
91 |
92 |
93 |
94 | Supprimer
95 | Nouvelle note
96 | Mettre à jour
97 |
98 |
--------------------------------------------------------------------------------
/res/values-it/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Impostazioni
7 | Ciao mondo!
8 | Impostazioni
9 | MyOwnNotes
10 | Note
11 | Info
12 | Aiuto
13 |
14 |
15 | Titolo nota
16 | Contenuto nota
17 | salva
18 | elimina
19 | La nota è stata salvata
20 | prova
21 | Salva nota
22 | Elimina nota
23 |
24 | Nuova nota salvata
25 | Cambiamenti salvati
26 | Nota eliminata
27 | Nota segnata per la cancellazione
28 |
29 |
30 | Crea nuova nota
31 | sincronizza
32 | Info
33 | Aiuto
34 | Non ci sono note salvate. Non ne hai creata nessuna o non sono ancora state sincronizzate con ownCloud.
35 | Sembra che tu stia provando a connetterti ad un server che utilizza un certificato auto-firmato. Per usare questa connessione avrai prima bisogno di aggiungere manualmente il certificato del server in Android. \n\nVuoi vedere un tutorial su come farlo?
36 | Sì
37 | No, grazie
38 |
39 | Impossibile ottenere un JSON corretto dal server. Il server è OK?
40 | L\'URL che hai inserito non è scritto correttamente
41 | L\'URL che hai inserito sembra non esistere. Controlla errori di scrittura o la tua connessione ad Internet.
42 | C\'è un errore di connessione.
43 | Per favore controlla il nome utente e la password.
44 | Non è stata trovata una connessione ad Internet. Connettersi ad Internet per sincronizzare.
45 | Sincronizzazione in corso
46 |
47 |
48 | Credenziali:
49 | Indirizzo-Server:
50 | https://www.server.it[:porta]
51 | https://
52 | Nome utente:
53 | nomeutente
54 | Password:
55 | password
56 | Sincronizzazione
57 | Sincronizza automaticamente
58 | Titolo Nota Predefinito
59 | Data e ora
60 | Impostazioni salvate
61 | Debug
62 | Abilita più informazioni di debug nel LogCat
63 |
64 |
65 | Per favore inserisci il nome utente associato al server-ownCloud
66 | Per favore inserisci la password associata al server-ownCloud
67 | Per favore inserisci un URL valido. Deve iniziare con \"https://\"
68 |
69 |
70 | Logo aykit
71 | Questa applicazione è stata realizzata per te da aykit - un\'associazione che supporta arte, cultura e scienza. \nMaggiori informazioni sul nostro sito: \n\nhttp://aykit.org
72 |
73 |
74 |
75 | Quale URL dovrei inserire?\n
76 | Inserisci l\'URL della radice del server ownCloud - è tutto: si tratta dello stesso URL che usi per connetterti al tuo ownCloud dal tuo browser.\n(e.g.: https://myowncloud.it)
77 | \n\n
78 | Posso usare quest\'app per connettermi ad ownCloud tramite http invece che https?\n
79 | No, questo non è possibile. Le API-Note richiedono che il nome utente e la password siano inviati per ogni connessione. Se si utilizzasse l\'http, saresti costretto ad inviare queste informazioni vitali sotto forma di testo in chiaro, e ciò non sarebbe per niente una buona idea! \n(Perchè? Guarda qui: Attacco "Man-in-the-middle" https://it.wikipedia.org/wiki/Attacco_man_in_the_middle)
80 | \n\n
81 | Ho un server ownCloud con un certificato auto-firmato. Posso usarlo per quest\'app?\n
82 | Sì che puoi - ma non all\'istante. Devi prima dire specificatamente ad Android di accettare il tuo certificato auto-firmato. Questo si può fare scaricando il certificato del tuo server e importandolo in Android dalle Impostazioni (nella sezione Sicurezza).
83 | \nGuarda un tutorial su come farlo: http://aykit.org/sites/myownnotes.html
84 |
85 |
86 |
87 | per Cancellare
88 | nuova Nota
89 | per Aggiornare
90 |
91 |
--------------------------------------------------------------------------------
/res/values-sr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ownCloud Белешке
6 | Поставке
7 | Здраво свете!
8 | Поставке
9 | Белешке
10 | Белешка
11 | О програму
12 | Помоћ
13 |
14 |
15 | Име
16 | Садржај
17 | сачувај
18 | обриши
19 | Белешка је сачувана
20 | тест
21 | Сачувај белешку
22 | Обриши белешку
23 |
24 | Нова белешка сачувана
25 | Измене сачуване
26 | Белешка обрисана
27 | Белешка означена за брисање
28 |
29 |
30 | Направи нову белешку
31 | синхронизуј
32 | О програму
33 | Помоћ
34 | Нема сачуваних белешки. Или их нисте направили или још нисте синхронизовали ваш ownCloud сервер.
35 | Изгледа да покушавате да се повежете на сервер који користи самопотписани сертификат. Да бисте могли да отворите ову везу мораћете ручно да додате сертификат овог сервера у Андроидов менаџер сертификата. \n\nЖелите ли да погледате упутство како да то учините?
36 | Да
37 | Не, хвала
38 |
39 | Не добијам исправан ЈСОН са сервера. Да ли је сервер у реду?
40 | УРЛ са којег захтевате податке није исправно формиран
41 | УРЛ са којег захтевате податке изгледа не постоји. Проверите унос сервера или вашу везу са интернетом
42 | Грешка повезивања.
43 | Проверите ваше корисничко име и лозинку.
44 | Нема везе са интернетом. Повежите се на интернет да бисте синхронизовали.
45 | Синхронизација у току
46 |
47 |
48 | Подаци за пријаву:
49 | Адреса сервера:
50 | www.vasowncloudserver.com
51 | https://
52 | Корисничко име:
53 | корисничко_име
54 | Лозинка:
55 | лозинка
56 | Синхронизација
57 | Синхронизуј аутоматски
58 | Подраз. име белешке
59 | Датум и време
60 | Поставке су сачуване
61 | Отклањање грешака
62 | Омогући исцрпан излаз за LogCat
63 |
64 |
65 | Унесите корисничко име за ваш ownCloud сервер
66 | Унесите лозинку за ваш ownCloud сервер
67 | Унесите исправну адресу. Мора почети са „https://“
68 |
69 |
70 | „aykit“ лого
71 |
72 | Ову апликацију вам доноси „aykit“ — удружење које подржава уметност, културу и науку. \nВише података на нашем вебсајту: \n\nhttp://aykit.org
73 |
74 |
75 |
76 |
77 | Коју адресу да унесем?\n
78 | Унесите УРЛ до корена ваше ownCloud инсталације — тј. исту адресу коју користите да се повежете на ownCloud сервер помоћу веб прегледача.\n(нпр: https://myowncloud.com)
79 | \n\n
80 | Могу ли се повезати на мој ownCloud сервер преко „http“ уместо „https“?\n
81 | Не, то није могуће. АПИ белешки захтева корисничко име и лозинку за свако повезивање. Користећи „http“ послали бисте ове важне податке као обичан текст, а то није добра идеја! \n(Зашто? Прочитајте ово: "Човек-у-средини"-напад http://en.wikipedia.org/wiki/Man-in-the-middle_attack)
82 | \n\n
83 | Поседујем ownCloud сервер са самопотписаним сертификатом. Хоће ли ова апликација радити за мој сервер?\n
84 | Да, хоће — али морате посебно „рећи“ Андроиду да прихвати ваш самопотписани сертификат. Ово се постиже ручним додавањем сертификата сервера у Андроидов менаџер сертификата.
85 | \nУпутство како да то урадите: http://aykit.org/sites/myownnotes.html
86 |
87 |
88 |
89 | за брисање
90 | нова белешка
91 | за ажурирање
92 |
93 |
94 |
--------------------------------------------------------------------------------
/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 54dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values-tr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Ayarlar
7 | Merhaba dünya!
8 | Ayarlar
9 | MyOwnNotes
10 | Not
11 | Hakkında
12 | Yardım
13 |
14 |
15 | Not başlığı
16 | Not içeriği
17 | kaydet
18 | sil
19 | Not kaydedildi
20 | test
21 | Notu kaydet
22 | Notu sil
23 |
24 | Yeni not kaydedildi
25 | Değişiklikler kayedildi
26 | Not silindi
27 | Not silinmek üzere işaretlendi
28 |
29 |
30 | Yeni not oluştur
31 | eşitle
32 | Hakkında
33 | Yardım
34 | Kayıtlı not yok. Hiçbir not oluşturmadınız ya da henüz ownCloud\'ınız ile eşitlemediniz.
35 | Görünüyor ki, kendinden imzalanmış bir sertifika kullanan sunucuya bağlanıyorsunuz. Bu bağlantıyı açabilmek için sunucunun sertifikasını Android key-chain (anahtarlık) içine el ile eklemelisiniz. \n\nNasıl yapacağınızı anlatan bir öğretici görmek istiyor musunuz?
36 | Evet
37 | Hayır, teşekkürler
38 |
39 | Sunucudan doğru JSON alınamıyor. Sunucu çalışıyor mu?
40 | Veri istediğiniz URL doğru bir şekilde biçimlendirilmemiş
41 | Veri istediğiniz URL mevcut değil gibi görünüyor. Yazımınızı veya İnternet bağlantınızı denetleyin
42 | Bir bağlantı hatası oluştu.
43 | Lütfen kullanıcı adı ve parolanızı denetleyin.
44 | TO TRANSLATE: No internet-connection has been found. Please connect to the internet to synchronize.
45 | TO TRANSLATE: Sync in progress
46 |
47 |
48 | Kimlik Bilgileri:
49 | Sunucu Adresi:
50 | https://www.sunucu.com[:port]
51 | https://
52 | Kullanıcı Adı:
53 | kullanıcı adı
54 | Parola:
55 | parola
56 | Eşitleme
57 | Otomatik eşitle
58 | Öntanımlı Not Başlığı
59 | Tarih ve zaman
60 | Ayarlar kaydedildi
61 | Hata ayıklama
62 | Arttırılmış LogCat çıktısını etkinleştir
63 |
64 | Lütfen ownCloud sunucu kullanıcı adınızı girin
65 | Lütfen ownCloud sunucu parolanızı girin
66 | Lütfen geçerli bir URL girin. \"https://\" ile başlamalıdır
67 |
68 |
69 | Aykit logosu
70 | Bu uygulama size, sanat, kültür ve bilimi destekleyen bir topluluk olan aykit tarafından sunuldu. \nAyrıntılı bilgi web sitemizde: \n\nhttp://aykit.org
71 |
72 |
73 |
74 | Hangi URL girmeliyim?\n
75 | ownCloud kurulumunuzun kök adresini girin - bu, tarayıcı ile ownCloud kurulumunuza eriştiğiniz URL ile aynıdır.\n(örn.: https://owncloudım.com)
76 | \n\n
77 | Bu uygulamayı ownCloud kurulumuma https ile değil de http ile bağlanabilir miyim?\n
78 | Hayır, bu mümkün değil. Notlar API, kullanıcı adı ve parolanın her bağlantı için gönderilmesini gerektirir. HTTP kullanırsanız, bu önemli bilgileri düz metin olarak gönderirsiniz. Pek iyi bir fikir değil! \n(Niçin? Bunu okuyun "Ortadaki Adam" Saldırısı http://tr.wikipedia.org/wiki/Man-in-the-middle_attack)
79 | \n\n
80 | Kendinden imzalı bir ownCloud sunucum var. Bu uygulamayı sunucum için kullanabilir miyim?\n
81 | Evet, ancak geldiği gibi değil. Android sisteminize, kendi imzalanmış sertifikanızı kabul etmesini söylemelisiniz. Bu Android Anahtar Yöneticisi içine sunucu sertifikalarını el ile eklenerek yapılır.
82 | \nNasıl yapıldığını öğrenmek için bu öğreticiye bakın: http://aykit.org/sites/myownnotes.html
83 |
84 |
85 |
86 | Silinecek
87 | Yeni Not
88 | Güncellenecek
89 |
90 |
91 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MyOwnNotes
6 | Settings
7 | Hello world!
8 | Settings
9 | MyOwnNotes
10 | Note
11 | About
12 | Help
13 |
14 |
15 | Note title
16 | Note content
17 | save
18 | delete
19 | Note has been saved
20 | test
21 | Save note
22 | Delete note
23 |
24 | New note saved
25 | Changes saved
26 | Note deleted
27 | Note marked for deletion
28 |
29 |
30 | Create new note
31 | synchronize
32 | About
33 | Help
34 | There are no saved notes. You either did not create any or have not yet synched with your ownCloud.
35 | It seems you are trying to connect to a server that uses a self-signed certificate. To be able to open this connection, you have to manually add the server\'s certificate to Androids key-chain. \n\nDo you want to see a tutorial on how to do that?
36 | Yes
37 | No, thanks
38 |
39 | Not getting correct JSON from server. Server OK?
40 | The URL you request data from is not correctly formed
41 | The URL you request data from doesn\'t seem to exist. Check spelling or your internet-connection
42 | There was a connection error.
43 | Please check your username and password.
44 | No internet-connection has been found. Please connect to the internet to synchronize.
45 | Sync in progress
46 |
47 |
48 | Credentials:
49 | Server-Address:
50 | https://www.server.com[:port]
51 | https://
52 | Username:
53 | username
54 | Password:
55 | password
56 | Synchronization
57 | Sync automatically
58 | Default Note Title
59 | Date and time
60 | Settings saved
61 | Debug
62 | Enable extensive LogCat output
63 |
64 |
65 | Please enter your ownCloud-server username
66 | Please enter your ownCloud-server password
67 | Please enter a valid URL. Must begin with \"https://\"
68 |
69 |
70 | The aykit logo
71 |
72 | This app is brought to you by aykit - an association supporting art, culture and science. \nMore information on our website: \n\nhttp://aykit.org
73 |
74 |
75 |
76 |
77 | Which URL should I enter?\n
78 | Enter the URL to the root of your ownCloud installation - that is: the same URL you use to connect to your ownCloud via the browser.\n(e.g.: https://myowncloud.com)
79 | \n\n
80 | Can I use this app to connect to my ownCloud via http and not https ?\n
81 | No, that is not possible. The Notes-API requests username and password to be sent for each connection. If you used http, you would send these vital informations as plaintext. Not a good idea! \n(Why? Read this: "Man-in-the-middle"-Attack http://en.wikipedia.org/wiki/Man-in-the-middle_attack)
82 | \n\n
83 | I have an ownCloud server with a self-signed certificate. Can I use this app for my server?\n
84 | Yes, you can - but not out-of-the-box. You have to specifically tell Android to accept your self-signed certificate. This is done by manually adding the servers certificate to Androids Key-Manager.
85 | \nSee this tutorial on how to do that: http://aykit.org/sites/myownnotes.html
86 |
87 |
88 |
89 | to Delete
90 | new Note
91 | to Update
92 |
93 |
94 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/src/org/aykit/owncloud_notes/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package org.aykit.owncloud_notes;
2 | import android.support.v4.app.NavUtils;
3 | import android.app.Activity;
4 | import android.content.SharedPreferences;
5 | import android.os.Bundle;
6 | import android.preference.PreferenceManager;
7 | import android.util.Log;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.WindowManager;
11 | import android.webkit.URLUtil;
12 | import android.widget.CheckBox;
13 | import android.widget.EditText;
14 | import android.widget.Toast;
15 |
16 | import org.aykit.MyOwnNotes.R;
17 |
18 |
19 | public class SettingsActivity extends Activity {
20 |
21 | public static final String TAG = SettingsActivity.class.getSimpleName();
22 | public static final String PREF_USERNAME = "username";
23 | public static final String PREF_PASSWOORD = "password";
24 | public static final String PREF_ADDRESS = "address";
25 | public static final String PREF_AUTOSYNC = "sync";
26 | public static final String PREF_DEFAULT_TITLE = "defaultTitle";
27 | public static final String PREF_INITIALIZED = "initialized";
28 | public static final String PREF_MENU_INFLATED = "menuInflated";
29 | public static final String PREF_EXTENSIVE_LOG = "extensiveLog";
30 | public static final String PREF_SYNC_IN_PROGRESS = "syncInProgress";
31 |
32 | private final int minimumPasswordLength = 1;
33 | private final char[] forbiddenSymbols = { '"', '\'' };
34 |
35 | private EditText username;
36 | private EditText password;
37 | private EditText address;
38 | private CheckBox autoSync;
39 | private CheckBox defaultTitle;
40 | private CheckBox extensiveLogCat;
41 | private SharedPreferences settings;
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 |
47 | getActionBar().setDisplayHomeAsUpEnabled(true);
48 |
49 | setContentView(R.layout.activity_settings);
50 |
51 | //make sure that keyboard is not shown right up
52 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
53 |
54 | username = (EditText) findViewById(R.id.edittext_username);
55 | password = (EditText) findViewById(R.id.edittext_password);
56 | address = (EditText) findViewById(R.id.edittext_server_address);
57 | autoSync = (CheckBox) findViewById(R.id.checkbox_sync_automatically);
58 | defaultTitle = (CheckBox) findViewById(R.id.checkbox_defaultnotetitle);
59 | extensiveLogCat = (CheckBox) findViewById(R.id.checkbox_extensive_log);
60 |
61 | settings = PreferenceManager.getDefaultSharedPreferences(this);
62 |
63 | username.setText( settings.getString(PREF_USERNAME, ""));
64 | password.setText(settings.getString(PREF_PASSWOORD, ""));
65 | address.setText(settings.getString(PREF_ADDRESS, ""));
66 | autoSync.setChecked(settings.getBoolean(PREF_AUTOSYNC, true));
67 | defaultTitle.setChecked( settings.getBoolean(PREF_DEFAULT_TITLE, true));
68 | extensiveLogCat.setChecked(settings.getBoolean(PREF_EXTENSIVE_LOG, false));
69 | }
70 |
71 | @Override
72 | public boolean onCreateOptionsMenu(Menu menu) {
73 | // Inflate the menu; this adds items to the action bar if it is present.
74 | getMenuInflater().inflate(R.menu.settings, menu);
75 | return true;
76 | }
77 |
78 | @Override
79 | public boolean onOptionsItemSelected(MenuItem item) {
80 |
81 | switch (item.getItemId())
82 | {
83 | // Respond to the action bar's Up/Home button
84 | case android.R.id.home:
85 |
86 | updateSettings();
87 | NavUtils.navigateUpFromSameTask(this);
88 | return true;
89 | }
90 | return super.onOptionsItemSelected(item);
91 | }
92 |
93 | @Override
94 | protected void onPause()
95 | {
96 | super.onPause();
97 | updateSettings();
98 | }
99 |
100 | /**
101 | * updates the in DefaultSharedPreferences saved username, password, server-url and checkbox-states
102 | * with the given information in EditText-fields.
103 | * But only iff EditTexts contain valid values.
104 | * produces Toasts to let user know if something - and what - has gone wrong.
105 | *
calls the following methods to check validity of username, password and url:
106 | *