From 2954b33f97b40cb0ec14eb99598646aade17a76c Mon Sep 17 00:00:00 2001 From: massimiliano <massimiliano@disroot.org> Date: Tue, 18 Dec 2018 21:00:58 +0100 Subject: [PATCH] Added Notes app --- .idea/assetWizardSettings.xml | 4 +- .../disroot/disrootapp/ui/MainActivity.java | 63 +++++++++++++++++++ app/src/main/res/drawable/ic_notes.xml | 5 ++ app/src/main/res/layout/activity_main.xml | 34 +++++++--- app/src/main/res/values-es/strings.xml | 4 ++ app/src/main/res/values-fr/strings.xml | 4 ++ app/src/main/res/values-it/strings.xml | 4 ++ app/src/main/res/values-nl/strings.xml | 4 ++ app/src/main/res/values-pt/strings.xml | 4 ++ app/src/main/res/values-sr/strings.xml | 4 ++ app/src/main/res/values/strings.xml | 4 ++ 11 files changed, 123 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/drawable/ic_notes.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index d5af6ef..aff8ae7 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -14,8 +14,8 @@ <option name="values"> <map> <entry key="assetSourceType" value="FILE" /> - <entry key="outputName" value="ic_clear_cache" /> - <entry key="sourceFile" value="$PROJECT_DIR$/../DisIcons/clear_cache.svg" /> + <entry key="outputName" value="ic_note" /> + <entry key="sourceFile" value="$PROJECT_DIR$/../DisIcons/ic_note.svg" /> </map> </option> </PersistentState> diff --git a/app/src/main/java/org/disroot/disrootapp/ui/MainActivity.java b/app/src/main/java/org/disroot/disrootapp/ui/MainActivity.java index c712275..6a60190 100644 --- a/app/src/main/java/org/disroot/disrootapp/ui/MainActivity.java +++ b/app/src/main/java/org/disroot/disrootapp/ui/MainActivity.java @@ -507,6 +507,32 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL }); + button = findViewById(R.id.NotesBtn);//NotesBtn + button.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + showNotesInfo(); + return true; + } + }); + button.setOnClickListener(new View.OnClickListener() { + public void onClick(View arg0) { + //first time tap check + if (firstStart.getBoolean("firsttap", true)){ + showFirstTap(); + firstStart.edit().putBoolean("firsttap", false).apply(); + return; + } + String NotesApp = "it.niedermann.owncloud.notes"; + Intent notes = getPackageManager().getLaunchIntentForPackage(NotesApp); + if(notes == null) { + showNotesDialog(); + return; + } + else startActivity(notes); + } + }); + button = findViewById(R.id.UserBtn);//UserBtn button.setOnLongClickListener(new View.OnLongClickListener() { @Override @@ -1043,6 +1069,43 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL builder.show(); } + //There is no extra info about Nextcoud notes yet + private void showNotesInfo() { + final ScrollView dashboard = findViewById(R.id.dashboard); + AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); + builder.setCancelable(false); + builder.setTitle(R.string.NotesTitle); + builder.setMessage(getString(R.string.NotesInfo)); + builder.setPositiveButton(R.string.global_ok, null); + //builder.setNegativeButton(R.string.tell_more, new DialogInterface.OnClickListener() { + // @Override + // public void onClick(DialogInterface dialog, int which) { + // webView.loadUrl(Constants.URL_DisApp_NOTESHELP); + // webView.setVisibility(View.VISIBLE); + // dashboard.setVisibility(View.GONE); + // } + //}); + builder.show(); + } + private void showNotesDialog(){ + final ScrollView dashboard = findViewById(R.id.dashboard); + AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); + builder.setCancelable(false); + builder.setTitle(R.string.DiaInstallTitle); + builder.setMessage(getString(R.string.NotesDialog)); + builder.setPositiveButton(R.string.global_install, new DialogInterface.OnClickListener() { + String NotesApp = "it.niedermann.owncloud.notes"; + Intent notes = getPackageManager().getLaunchIntentForPackage(NotesApp); + @Override + public void onClick(DialogInterface dialog, int which) { + notes = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + NotesApp)); + startActivity(notes); + } + }); + builder.setNegativeButton(R.string.global_cancel , null); + builder.show(); + } + private void showUserInfo() { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setCancelable(false) diff --git a/app/src/main/res/drawable/ic_notes.xml b/app/src/main/res/drawable/ic_notes.xml new file mode 100644 index 0000000..67351c0 --- /dev/null +++ b/app/src/main/res/drawable/ic_notes.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:viewportHeight="48" + android:viewportWidth="48" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillAlpha="1" android:fillColor="#ffffff" + android:pathData="m12.625,30.625 l4.75,4.75L15.75,37L14,37L14,34L11,34L11,32.25ZM25.5625,18.4375c0.25,0.2188 0.1875,0.6563 -0.0938,0.9375L16.375,28.4688C16.0938,28.75 15.6563,28.8125 15.4375,28.5625 15.1875,28.3437 15.25,27.9062 15.5313,27.625L24.625,18.5312c0.2813,-0.2813 0.7188,-0.3438 0.9375,-0.0937zM17,40 L34,23 25,14 8,31v9zM27,12 L29.875,9.125c1.1563,-1.1563 1.1563,-3.0938 0,-4.25l-4.75,-4.75c-1.1563,-1.1563 -3.0938,-1.1563 -4.25,0L27,12ZM48,9v30c0,4.9688 -4.0313,9 -9,9L9,48C4.0313,48 0,43.9688 0,39L0,9C0,4.0313 4.0313,0 9,0h30c4.9688,0 9,4.0313 9,9z" android:strokeWidth="0.03125"/> +</vector> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 6ee3367..08d9d32 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -194,13 +194,22 @@ android:gravity="center_horizontal" android:id="@+id/group4" android:layout_below="@+id/group3"> + <Button + android:id="@+id/NotesBtn" + style="?android:attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="24dp" + android:drawableTop="@drawable/ic_notes" + android:text="@string/action_notes" + android:textColor="#ffffff" /> <Button android:id="@+id/UserBtn" style="?android:attr/borderlessButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxWidth="24dp" - android:drawableTop="@drawable/ic_poll" + android:drawableTop="@drawable/ic_user" android:text="@string/action_user" android:textColor="#ffffff" /> @@ -224,15 +233,22 @@ android:text="@string/action_howto" android:textColor="#ffffff" /> - <Button - android:id="@+id/AboudBtn" - style="?android:attr/borderlessButtonStyle" - android:layout_width="wrap_content" + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:maxWidth="24dp" - android:drawableTop="@drawable/ic_about" - android:text="@string/action_about" - android:textColor="#ffffff" /> + android:id="@+id/group5" + android:layout_below="@+id/group4"><!-- android:gravity="center_horizontal" --> + <Button + android:id="@+id/AboudBtn" + style="?android:attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="24dp" + android:drawableTop="@drawable/ic_about" + android:text="@string/action_about" + android:textColor="#ffffff" /> </LinearLayout> </RelativeLayout> </ScrollView> diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8891e51..eec6abe 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -152,4 +152,8 @@ <string name="Scheduled">Scheduled</string> <string name="Investigating">Investigating</string> <string name="Identified">Identified</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 5ee52b6..69a13f6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -181,4 +181,8 @@ <string name="Scheduled">Scheduled</string> <string name="Investigating">Investigating</string> <string name="Identified">Identified</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index aa525db..51f8a5e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -151,4 +151,8 @@ <string name="Scheduled">Pianificato</string> <string name="Investigating">Indagando</string> <string name="Identified">Identificato</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6f55f67..8e80b62 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -152,4 +152,8 @@ <string name="Scheduled">Gepland</string> <string name="Investigating">Aan het onderzoeken</string> <string name="Identified">Geïdentificeerd</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index a0d0590..714bbc5 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -151,4 +151,8 @@ <string name="Scheduled">Scheduled</string> <string name="Investigating">Investigating</string> <string name="Identified">Identified</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 2ce8c74..a4c8758 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -152,4 +152,8 @@ <string name="Scheduled">Scheduled</string> <string name="Investigating">Investigating</string> <string name="Identified">Identified</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7608812..c97ce26 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -152,4 +152,8 @@ <string name="Scheduled">Scheduled</string> <string name="Investigating">Investigating</string> <string name="Identified">Identified</string> + <string name="NotesTitle">Nextcloud Notes Info</string> + <string name="NotesInfo">The notes app is a distraction free notes taking app for Nextcloud</string> + <string name="NotesDialog">To continue you need to install Notes first.\nPlease select install to continue with the installatin on F-Droid.</string> + <string name="action_notes">Notes</string> </resources> -- GitLab