This commit is contained in:
Niedermann IT-Dienstleistungen 2018-04-06 20:36:46 +02:00
commit 6c16a9292a
7 changed files with 53 additions and 0 deletions

View file

@ -141,5 +141,17 @@
android:name=".android.appwidget.NoteListWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<service
android:name="it.niedermann.owncloud.notes.android.quicksettings.NewNoteTileService"
android:icon="@drawable/ic_quicksettings_new"
android:label="@string/action_create"
android:description="@string/action_create"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
</application>
</manifest>

View file

@ -0,0 +1,41 @@
package it.niedermann.owncloud.notes.android.quicksettings;
import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
/**
* This {@link TileService} adds a quick settings tile that leads to the new note view.
*/
@TargetApi(Build.VERSION_CODES.N)
public class NewNoteTileService extends TileService {
@Override
public void onStartListening() {
Tile tile = getQsTile();
tile.setState(Tile.STATE_ACTIVE);
tile.updateTile();
}
@Override
public void onClick() {
// create new note intent
final Intent newNoteIntent = new Intent(getApplicationContext(), EditNoteActivity.class);
// ensure it won't open twice if already running
newNoteIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// ask to unlock the screen if locked, then start new note intent
unlockAndRun(new Runnable() {
@Override
public void run() {
startActivityAndCollapse(newNoteIntent);
}
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB