mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-28 11:29:01 +03:00
Merge branch 'master' of https://github.com/stefan-niedermann/nextcloud-notes
This commit is contained in:
commit
6c16a9292a
7 changed files with 53 additions and 0 deletions
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-hdpi/ic_quicksettings_new.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_quicksettings_new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_quicksettings_new.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_quicksettings_new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 900 B |
BIN
app/src/main/res/drawable-xhdpi/ic_quicksettings_new.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_quicksettings_new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_quicksettings_new.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_quicksettings_new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_quicksettings_new.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_quicksettings_new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Loading…
Reference in a new issue