mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-24 13:56:14 +03:00
Remove permanent notification in favor of tile
Cleanup after #348 (Added support for a quick settings tile for creating a new note)
This commit is contained in:
parent
6c16a9292a
commit
5d50b55af3
4 changed files with 12 additions and 54 deletions
|
@ -114,16 +114,10 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
|
|||
setupNotesList();
|
||||
setupNavigationList(categoryAdapterSelectedItem);
|
||||
setupNavigationMenu();
|
||||
|
||||
// Show persistant notification for creating a new note
|
||||
checkNotificationSetting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
// Show persistant notification for creating a new note
|
||||
checkNotificationSetting();
|
||||
|
||||
// refresh and sync every time the activity gets visible
|
||||
refreshLists();
|
||||
db.getNoteServerSyncHelper().addCallbackPull(syncCallBack);
|
||||
|
@ -355,33 +349,6 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
|
|||
listNavigationMenu.setAdapter(adapterMenu);
|
||||
}
|
||||
|
||||
protected void checkNotificationSetting() {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
boolean showNotification = preferences.getBoolean(getString(R.string.pref_key_show_notification), false);
|
||||
if (showNotification) {
|
||||
// add notification
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
PendingIntent newNoteIntent = PendingIntent.getActivity(this, 0,
|
||||
new Intent(this, EditNoteActivity.class)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP),
|
||||
0);
|
||||
builder.setSmallIcon(R.drawable.ic_action_new)
|
||||
.setContentTitle(getString(R.string.action_create))
|
||||
.setContentText("")
|
||||
.setOngoing(true)
|
||||
.setContentIntent(newNoteIntent)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(
|
||||
NOTIFICATION_SERVICE);
|
||||
|
||||
notificationManager.notify(10, builder.build());
|
||||
} else {
|
||||
// remove notification
|
||||
NotificationManager nMgr = (NotificationManager) getApplicationContext().getSystemService(NOTIFICATION_SERVICE);
|
||||
nMgr.cancel(10);
|
||||
}
|
||||
}
|
||||
|
||||
public void initList() {
|
||||
adapter = new ItemAdapter(this);
|
||||
RecyclerView listView = findViewById(R.id.recycler_view);
|
||||
|
@ -499,7 +466,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
|
|||
getMenuInflater().inflate(R.menu.menu_list_view, menu);
|
||||
// Associate searchable configuration with the SearchView
|
||||
final MenuItem item = menu.findItem(R.id.search);
|
||||
searchView = (SearchView) MenuItemCompat.getActionView(item);
|
||||
searchView = (SearchView) item.getActionView();
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
<string name="settings_submitting">Connecting …</string>
|
||||
<string name="settings_view_category">View settings</string>
|
||||
<string name="settings_note_mode">Display mode for Notes</string>
|
||||
<string name="settings_notification_title">\"Create note\" as notification</string>
|
||||
<string name="settings_notification">Enable to show a persistent notification for quickly creating new notes.</string>
|
||||
<string name="settings_cert_category">Certificates</string>
|
||||
<string name="settings_cert_trust_system">Trust system certificates</string>
|
||||
<string name="settings_cert_trust_system_on">System and user-added CAs will be trusted (recommended)</string>
|
||||
|
@ -140,7 +138,6 @@
|
|||
<!-- Key / Values for preferences -->
|
||||
<string name="pref_key_trust_system_certs" translatable="false">trustSystemCerts</string>
|
||||
<string name="pref_key_reset_trust" translatable="false">resetTrust</string>
|
||||
<string name="pref_key_show_notification" translatable="false">showNotification</string>
|
||||
<string name="pref_key_note_mode" translatable="false">noteMode</string>
|
||||
<string name="pref_key_last_note_mode" translatable="false">lastNoteMode</string>
|
||||
<string name="pref_value_mode_edit" translatable="false">edit</string>
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_view_category">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key_show_notification"
|
||||
android:title="@string/settings_notification_title"
|
||||
android:summary="@string/settings_notification"
|
||||
/>
|
||||
<ListPreference
|
||||
android:defaultValue="@string/pref_value_mode_edit"
|
||||
android:key="@string/pref_key_note_mode"
|
||||
|
|
Loading…
Reference in a new issue