#554 App shortcuts for fav / recent notes and settings

This commit is contained in:
stefan-niedermann 2019-07-19 08:56:40 +02:00
parent 5e554a7dff
commit a30db4e41b
7 changed files with 65 additions and 16 deletions

View file

@ -19,13 +19,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBarDrawerToggle;
@ -39,6 +32,14 @@ import androidx.recyclerview.widget.ItemTouchHelper.SimpleCallback;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import it.niedermann.owncloud.notes.R;
@ -56,10 +57,13 @@ import it.niedermann.owncloud.notes.util.NotesClientUtil;
public class NotesListViewActivity extends AppCompatActivity implements ItemAdapter.NoteClickListener {
public final static String CREATED_NOTE = "it.niedermann.owncloud.notes.created_notes";
public final static String CREDENTIALS_CHANGED = "it.niedermann.owncloud.notes.CREDENTIALS_CHANGED";
public static final String CREATED_NOTE = "it.niedermann.owncloud.notes.created_notes";
public static final String CREDENTIALS_CHANGED = "it.niedermann.owncloud.notes.CREDENTIALS_CHANGED";
public static final String ADAPTER_KEY_RECENT = "recent";
public static final String ADAPTER_KEY_STARRED = "starred";
public static final String ACTION_FAVORITES = "it.niedermann.owncloud.notes.favorites";
public static final String ACTION_RECENT = "it.niedermann.owncloud.notes.recent";
private static final String SAVED_STATE_NAVIGATION_SELECTION = "navigationSelection";
private static final String SAVED_STATE_NAVIGATION_ADAPTER_SLECTION = "navigationAdapterSelection";
@ -122,7 +126,14 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
startActivityForResult(settingsIntent, server_settings);
}
String categoryAdapterSelectedItem = ADAPTER_KEY_RECENT;
if (savedInstanceState != null) {
if (savedInstanceState == null) {
if(ACTION_RECENT.equals(getIntent().getAction())) {
categoryAdapterSelectedItem = ADAPTER_KEY_RECENT;
} else if(ACTION_FAVORITES.equals(getIntent().getAction())) {
categoryAdapterSelectedItem = ADAPTER_KEY_STARRED;
navigationSelection = new Category(null, true);
}
} else {
navigationSelection = (Category) savedInstanceState.getSerializable(SAVED_STATE_NAVIGATION_SELECTION);
navigationOpen = savedInstanceState.getString(SAVED_STATE_NAVIGATION_OPEN);
categoryAdapterSelectedItem = savedInstanceState.getString(SAVED_STATE_NAVIGATION_ADAPTER_SLECTION);

View file

@ -6,7 +6,7 @@
<!-- App Bar -->
<item name="colorPrimary">@color/primary</item>
<!-- Status Bar and contextual Status Bars -->
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorPrimaryDark">@color/primary</item>
<!-- Snackbar Action Link -->
<item name="colorAccent">@color/primary</item>
<item name="windowActionModeOverlay">true</item>
@ -36,7 +36,7 @@
<style name="ocAlertDialog" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
<item name="colorAccent">@color/primary</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorPrimaryDark">@color/primary</item>
<item name="android:textColorPrimary">@color/fg_default</item>
<item name="android:alertDialogTheme">@style/cloudbutton</item>
<item name="android:windowBackground">@color/bg_normal</item>

View file

@ -12,4 +12,40 @@
android:targetClass="it.niedermann.owncloud.notes.android.activity.EditNoteActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
<shortcut
android:shortcutId="it.niedermann.owncloud.notes.recent"
android:enabled="true"
android:icon="@drawable/ic_access_time_grey600_24dp"
android:shortcutShortLabel="@string/action_recent"
>
<intent
android:action="it.niedermann.owncloud.notes.recent"
android:targetPackage="it.niedermann.owncloud.notes"
android:targetClass="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
<shortcut
android:shortcutId="it.niedermann.owncloud.notes.favorite"
android:enabled="true"
android:icon="@drawable/ic_star_grey_ccc_24dp"
android:shortcutShortLabel="@string/label_favorites"
>
<intent
android:action="it.niedermann.owncloud.notes.favorites"
android:targetPackage="it.niedermann.owncloud.notes"
android:targetClass="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
<shortcut
android:shortcutId="it.niedermann.owncloud.notes.settings"
android:enabled="true"
android:icon="@drawable/ic_settings_grey600_24dp"
android:shortcutShortLabel="@string/action_settings"
>
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="it.niedermann.owncloud.notes"
android:targetClass="it.niedermann.owncloud.notes.android.activity.PreferencesActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>

View file

@ -8,7 +8,7 @@ buildscript {
}
dependencies {
apply plugin: 'maven'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

@ -1 +1 @@
Subproject commit 4fac9b14bc4e35fd317bcb75ae5e7f39c22b3c75
Subproject commit 1c3997978c3cc278e26cd63735ba860b1a399bbd

View file

@ -0,0 +1,2 @@
- Change dark primary color to primary color in status bar
- App shortcuts for fav / recent notes and settings (#554)

View file

@ -1,6 +1,6 @@
#Sun Nov 04 12:05:52 CET 2018
#Fri May 10 17:09:56 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip