mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-25 14:26:13 +03:00
Change activity flow: NotesList -> EditNote -> PreviewNote (#141)
Fix #3 and fix #39
This commit is contained in:
parent
5895dc113b
commit
f2e275c082
13 changed files with 103 additions and 112 deletions
|
@ -39,7 +39,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name="it.niedermann.owncloud.notes.android.activity.NoteActivity"
|
android:name="it.niedermann.owncloud.notes.android.activity.NoteActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"></activity>
|
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.EditNoteActivity"></activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="it.niedermann.owncloud.notes.android.activity.SettingsActivity"
|
android:name="it.niedermann.owncloud.notes.android.activity.SettingsActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
@ -58,7 +58,8 @@
|
||||||
<activity
|
<activity
|
||||||
android:name="it.niedermann.owncloud.notes.android.activity.EditNoteActivity"
|
android:name="it.niedermann.owncloud.notes.android.activity.EditNoteActivity"
|
||||||
android:label="@string/menu_edit"
|
android:label="@string/menu_edit"
|
||||||
android:windowSoftInputMode="stateVisible"></activity>
|
android:windowSoftInputMode="stateVisible"
|
||||||
|
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"></activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="it.niedermann.owncloud.notes.android.activity.AboutActivity"
|
android:name="it.niedermann.owncloud.notes.android.activity.AboutActivity"
|
||||||
android:label="@string/menu_about"
|
android:label="@string/menu_about"
|
||||||
|
|
|
@ -7,10 +7,10 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -20,14 +20,19 @@ import it.niedermann.owncloud.notes.R;
|
||||||
import it.niedermann.owncloud.notes.model.DBNote;
|
import it.niedermann.owncloud.notes.model.DBNote;
|
||||||
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
|
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
|
||||||
import it.niedermann.owncloud.notes.util.ICallback;
|
import it.niedermann.owncloud.notes.util.ICallback;
|
||||||
import it.niedermann.owncloud.notes.util.NoteUtil;
|
|
||||||
|
|
||||||
public class EditNoteActivity extends AppCompatActivity {
|
public class EditNoteActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
public static final String PARAM_NOTE = "note";
|
||||||
|
public static final String PARAM_NOTE_POSITION = "note_position";
|
||||||
|
|
||||||
private static final String LOG_TAG = "EditNote/SAVE";
|
private static final String LOG_TAG = "EditNote/SAVE";
|
||||||
private final long DELAY = 2000; // in ms
|
private static final long DELAY = 2000; // in ms
|
||||||
private final long DELAY_AFTER_SYNC = 5000; // in ms
|
private static final long DELAY_AFTER_SYNC = 5000; // in ms
|
||||||
|
|
||||||
private EditText content = null;
|
private EditText content = null;
|
||||||
private DBNote note = null;
|
private DBNote note = null;
|
||||||
|
private int notePosition = 0;
|
||||||
private Timer timer, timerNextSync;
|
private Timer timer, timerNextSync;
|
||||||
private boolean saveActive = false;
|
private boolean saveActive = false;
|
||||||
private ActionBar actionBar;
|
private ActionBar actionBar;
|
||||||
|
@ -37,8 +42,15 @@ public class EditNoteActivity extends AppCompatActivity {
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_edit);
|
setContentView(R.layout.activity_edit);
|
||||||
note = (DBNote) getIntent().getSerializableExtra(
|
if (savedInstanceState == null) {
|
||||||
NoteActivity.EDIT_NOTE);
|
Log.d(getClass().getSimpleName(), "Starting from Intent");
|
||||||
|
note = (DBNote) getIntent().getSerializableExtra(PARAM_NOTE);
|
||||||
|
notePosition = getIntent().getIntExtra(PARAM_NOTE_POSITION, 0);
|
||||||
|
} else {
|
||||||
|
Log.d(getClass().getSimpleName(), "Starting from SavedState");
|
||||||
|
note = (DBNote) savedInstanceState.getSerializable(PARAM_NOTE);
|
||||||
|
notePosition = savedInstanceState.getInt(PARAM_NOTE_POSITION);
|
||||||
|
}
|
||||||
content = (EditText) findViewById(R.id.editContent);
|
content = (EditText) findViewById(R.id.editContent);
|
||||||
content.setText(note.getContent());
|
content.setText(note.getContent());
|
||||||
content.setEnabled(true);
|
content.setEnabled(true);
|
||||||
|
@ -51,13 +63,11 @@ public class EditNoteActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
content.addTextChangedListener(new TextWatcher() {
|
content.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
int after) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(final CharSequence s, int start, int before,
|
public void onTextChanged(final CharSequence s, int start, int before, int count) {
|
||||||
int count) {
|
|
||||||
if (timer != null) {
|
if (timer != null) {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
timer = null;
|
timer = null;
|
||||||
|
@ -89,20 +99,71 @@ public class EditNoteActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
outState.putSerializable(PARAM_NOTE, note);
|
||||||
|
outState.putInt(PARAM_NOTE_POSITION, notePosition);
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
saveAndClose();
|
saveAndClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main-Menu
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.menu_note_list_view, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main-Menu-Handler
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
NoteSQLiteOpenHelper db;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
saveAndClose();
|
saveAndClose();
|
||||||
return true;
|
return true;
|
||||||
}
|
case R.id.menu_delete:
|
||||||
|
db = new NoteSQLiteOpenHelper(this);
|
||||||
|
db.deleteNoteAndSync(note.getId());
|
||||||
|
Intent data = new Intent();
|
||||||
|
data.putExtra(PARAM_NOTE_POSITION, notePosition);
|
||||||
|
setResult(RESULT_FIRST_USER, data);
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
case R.id.menu_preview:
|
||||||
|
saveData(null);
|
||||||
|
Intent previewIntent = new Intent(getApplicationContext(), NoteActivity.class);
|
||||||
|
previewIntent.putExtra(NoteActivity.PARAM_NOTE, note);
|
||||||
|
startActivity(previewIntent);
|
||||||
|
return true;
|
||||||
|
case R.id.menu_share:
|
||||||
|
Intent shareIntent = new Intent();
|
||||||
|
shareIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
shareIntent.setType("text/plain");
|
||||||
|
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, note.getTitle());
|
||||||
|
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, note.getContent());
|
||||||
|
startActivity(shareIntent);
|
||||||
|
return true;
|
||||||
|
/*case R.id.menu_copy:
|
||||||
|
db = new NoteSQLiteOpenHelper(this);
|
||||||
|
Note newNote = db.getNote(db.addNoteAndSync(note.getContent()));
|
||||||
|
newNote.setTitle(note.getTitle() + " (" + getResources().getString(R.string.copy) + ")");
|
||||||
|
db.updateNote(newNote);
|
||||||
|
finish();
|
||||||
|
return true;*/
|
||||||
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves all changes and closes the Activity
|
* Saves all changes and closes the Activity
|
||||||
|
@ -120,7 +181,8 @@ public class EditNoteActivity extends AppCompatActivity {
|
||||||
saveData(null);
|
saveData(null);
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.setAction(Intent.ACTION_VIEW);
|
data.setAction(Intent.ACTION_VIEW);
|
||||||
data.putExtra(NoteActivity.EDIT_NOTE, note);
|
data.putExtra(PARAM_NOTE, note);
|
||||||
|
data.putExtra(PARAM_NOTE_POSITION, notePosition);
|
||||||
setResult(RESULT_OK, data);
|
setResult(RESULT_OK, data);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,22 @@
|
||||||
package it.niedermann.owncloud.notes.android.activity;
|
package it.niedermann.owncloud.notes.android.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import it.niedermann.owncloud.notes.R;
|
import it.niedermann.owncloud.notes.R;
|
||||||
import it.niedermann.owncloud.notes.model.DBNote;
|
import it.niedermann.owncloud.notes.model.DBNote;
|
||||||
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
|
|
||||||
|
|
||||||
public class NoteActivity extends AppCompatActivity implements View.OnClickListener {
|
public class NoteActivity extends AppCompatActivity {
|
||||||
public final static String EDIT_NOTE = "it.niedermann.owncloud.notes.edit_note_id";
|
|
||||||
public final static int EDIT_NOTE_CMD = 1;
|
public static final String PARAM_NOTE = EditNoteActivity.PARAM_NOTE;
|
||||||
|
|
||||||
private DBNote note = null;
|
private DBNote note = null;
|
||||||
private int notePosition = 0;
|
|
||||||
private TextView noteContent = null;
|
private TextView noteContent = null;
|
||||||
private ActionBar actionBar = null;
|
private ActionBar actionBar = null;
|
||||||
|
|
||||||
|
@ -27,14 +24,10 @@ public class NoteActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_single_note);
|
setContentView(R.layout.activity_single_note);
|
||||||
note = (DBNote) getIntent().getSerializableExtra(
|
note = (DBNote) getIntent().getSerializableExtra(PARAM_NOTE);
|
||||||
NotesListViewActivity.SELECTED_NOTE);
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
note = (DBNote) savedInstanceState.getSerializable("note");
|
note = (DBNote) savedInstanceState.getSerializable(PARAM_NOTE);
|
||||||
}
|
}
|
||||||
notePosition = getIntent().getIntExtra(
|
|
||||||
NotesListViewActivity.SELECTED_NOTE_POSITION, 0);
|
|
||||||
findViewById(R.id.fab_edit).setOnClickListener(this);
|
|
||||||
actionBar = getSupportActionBar();
|
actionBar = getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.setTitle(note.getTitle());
|
actionBar.setTitle(note.getTitle());
|
||||||
|
@ -42,90 +35,24 @@ public class NoteActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
}
|
}
|
||||||
noteContent = (TextView) findViewById(R.id.single_note_content);
|
noteContent = (TextView) findViewById(R.id.single_note_content);
|
||||||
noteContent.setText(note.getSpannableContent());
|
noteContent.setText(note.getSpannableContent());
|
||||||
findViewById(R.id.fab_edit).setOnClickListener(this);
|
findViewById(R.id.fab_edit).setVisibility(View.GONE);
|
||||||
((TextView) findViewById(R.id.single_note_content)).setMovementMethod(LinkMovementMethod.getInstance());
|
((TextView) findViewById(R.id.single_note_content)).setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putSerializable("note", note);
|
outState.putSerializable(PARAM_NOTE, note);
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent editIntent = new Intent(this, EditNoteActivity.class);
|
|
||||||
editIntent.putExtra(EDIT_NOTE, note);
|
|
||||||
startActivityForResult(editIntent, EDIT_NOTE_CMD);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main-Menu
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
|
||||||
getMenuInflater().inflate(R.menu.menu_note_list_view, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main-Menu-Handler
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int id = item.getItemId();
|
switch (item.getItemId()) {
|
||||||
NoteSQLiteOpenHelper db;
|
case android.R.id.home:
|
||||||
switch (id) {
|
|
||||||
case R.id.menu_delete:
|
|
||||||
db = new NoteSQLiteOpenHelper(this);
|
|
||||||
db.deleteNoteAndSync(note.getId());
|
|
||||||
Intent data = new Intent();
|
|
||||||
data.putExtra(NotesListViewActivity.SELECTED_NOTE_POSITION,
|
|
||||||
notePosition);
|
|
||||||
setResult(RESULT_FIRST_USER, data);
|
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_share:
|
|
||||||
Intent shareIntent = new Intent();
|
|
||||||
shareIntent.setAction(Intent.ACTION_SEND);
|
|
||||||
shareIntent.setType("text/plain");
|
|
||||||
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
|
|
||||||
note.getTitle());
|
|
||||||
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,
|
|
||||||
note.getContent());
|
|
||||||
startActivity(shareIntent);
|
|
||||||
return true;
|
|
||||||
/*case R.id.menu_copy:
|
|
||||||
db = new NoteSQLiteOpenHelper(this);
|
|
||||||
Note newNote = db.getNote(db.addNoteAndSync(note.getContent()));
|
|
||||||
newNote.setTitle(note.getTitle() + " (" + getResources().getString(R.string.copy) + ")");
|
|
||||||
db.updateNote(newNote);
|
|
||||||
finish();
|
|
||||||
return true;*/
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
// Check which request we're responding to
|
|
||||||
if (requestCode == EDIT_NOTE_CMD) {
|
|
||||||
// Make sure the request was successful
|
|
||||||
if (resultCode == RESULT_OK) {
|
|
||||||
DBNote editedNote = (DBNote) data.getExtras().getSerializable(
|
|
||||||
EDIT_NOTE);
|
|
||||||
if (editedNote != null) {
|
|
||||||
note = editedNote;
|
|
||||||
noteContent.setText(note.getSpannableContent());
|
|
||||||
actionBar.setTitle(note.getTitle());
|
|
||||||
actionBar.setSubtitle(DateUtils.getRelativeDateTimeString(getApplicationContext(), note.getModified().getTimeInMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0));
|
|
||||||
}
|
|
||||||
data.putExtra(NotesListViewActivity.SELECTED_NOTE_POSITION,
|
|
||||||
notePosition);
|
|
||||||
setResult(RESULT_OK, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -37,9 +37,7 @@ import it.niedermann.owncloud.notes.util.NotesClientUtil;
|
||||||
public class NotesListViewActivity extends AppCompatActivity implements
|
public class NotesListViewActivity extends AppCompatActivity implements
|
||||||
ItemAdapter.NoteClickListener, View.OnClickListener {
|
ItemAdapter.NoteClickListener, View.OnClickListener {
|
||||||
|
|
||||||
public final static String SELECTED_NOTE = "it.niedermann.owncloud.notes.clicked_note";
|
|
||||||
public final static String CREATED_NOTE = "it.niedermann.owncloud.notes.created_notes";
|
public final static String CREATED_NOTE = "it.niedermann.owncloud.notes.created_notes";
|
||||||
public final static String SELECTED_NOTE_POSITION = "it.niedermann.owncloud.notes.clicked_note_position";
|
|
||||||
public final static String CREDENTIALS_CHANGED = "it.niedermann.owncloud.notes.CREDENTIALS_CHANGED";
|
public final static String CREDENTIALS_CHANGED = "it.niedermann.owncloud.notes.CREDENTIALS_CHANGED";
|
||||||
|
|
||||||
private final static int create_note_cmd = 0;
|
private final static int create_note_cmd = 0;
|
||||||
|
@ -336,12 +334,10 @@ public class NotesListViewActivity extends AppCompatActivity implements
|
||||||
}
|
}
|
||||||
} else if (requestCode == show_single_note_cmd) {
|
} else if (requestCode == show_single_note_cmd) {
|
||||||
if (resultCode == RESULT_OK || resultCode == RESULT_FIRST_USER) {
|
if (resultCode == RESULT_OK || resultCode == RESULT_FIRST_USER) {
|
||||||
int notePosition = data.getExtras().getInt(
|
int notePosition = data.getExtras().getInt(EditNoteActivity.PARAM_NOTE_POSITION);
|
||||||
SELECTED_NOTE_POSITION);
|
|
||||||
adapter.remove(adapter.getItem(notePosition));
|
adapter.remove(adapter.getItem(notePosition));
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
DBNote editedNote = (DBNote) data.getExtras().getSerializable(
|
DBNote editedNote = (DBNote) data.getExtras().getSerializable(EditNoteActivity.PARAM_NOTE);
|
||||||
NoteActivity.EDIT_NOTE);
|
|
||||||
adapter.add(editedNote);
|
adapter.add(editedNote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,12 +382,10 @@ public class NotesListViewActivity extends AppCompatActivity implements
|
||||||
mActionMode.finish();
|
mActionMode.finish();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(getApplicationContext(),
|
|
||||||
NoteActivity.class);
|
|
||||||
|
|
||||||
Item item = adapter.getItem(position);
|
Item item = adapter.getItem(position);
|
||||||
intent.putExtra(SELECTED_NOTE, (DBNote) item);
|
Intent intent = new Intent(getApplicationContext(), EditNoteActivity.class);
|
||||||
intent.putExtra(SELECTED_NOTE_POSITION, position);
|
intent.putExtra(EditNoteActivity.PARAM_NOTE, (DBNote) item);
|
||||||
|
intent.putExtra(EditNoteActivity.PARAM_NOTE_POSITION, position);
|
||||||
startActivityForResult(intent, show_single_note_cmd);
|
startActivityForResult(intent, show_single_note_cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,7 @@ import android.util.Log;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
import it.niedermann.owncloud.notes.R;
|
import it.niedermann.owncloud.notes.R;
|
||||||
import it.niedermann.owncloud.notes.android.activity.NoteActivity;
|
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
|
||||||
import it.niedermann.owncloud.notes.android.activity.NotesListViewActivity;
|
|
||||||
import it.niedermann.owncloud.notes.model.DBNote;
|
import it.niedermann.owncloud.notes.model.DBNote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,8 +23,8 @@ public class SingleNoteWidget extends AppWidgetProvider {
|
||||||
RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget_single_note);
|
RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget_single_note);
|
||||||
if (note != null) {
|
if (note != null) {
|
||||||
updateViews.setTextViewText(R.id.single_note_content, note.getSpannableContent());
|
updateViews.setTextViewText(R.id.single_note_content, note.getSpannableContent());
|
||||||
Intent intent = new Intent(context, NoteActivity.class);
|
Intent intent = new Intent(context, EditNoteActivity.class);
|
||||||
intent.putExtra(NotesListViewActivity.SELECTED_NOTE, note);
|
intent.putExtra(EditNoteActivity.PARAM_NOTE, note);
|
||||||
// http://stackoverflow.com/questions/4011178/multiple-instances-of-widget-only-updating-last-widget
|
// http://stackoverflow.com/questions/4011178/multiple-instances-of-widget-only-updating-last-widget
|
||||||
Uri data = Uri.withAppendedPath(
|
Uri data = Uri.withAppendedPath(
|
||||||
Uri.parse("notes" + "://widget/id/")
|
Uri.parse("notes" + "://widget/id/")
|
||||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_eye_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_eye_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 503 B |
BIN
app/src/main/res/drawable-mdpi/ic_eye_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_eye_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 360 B |
BIN
app/src/main/res/drawable-xhdpi/ic_eye_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_eye_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 629 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_eye_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_eye_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 932 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_eye_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_eye_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,6 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_preview"
|
||||||
|
android:icon="@drawable/ic_eye_white_24dp"
|
||||||
|
android:orderInCategory="80"
|
||||||
|
android:title="@string/menu_preview"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_share"
|
android:id="@+id/menu_share"
|
||||||
android:actionProviderClass="android.widget.ShareActionProvider"
|
android:actionProviderClass="android.widget.ShareActionProvider"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<string name="menu_delete">Löschen</string>
|
<string name="menu_delete">Löschen</string>
|
||||||
<string name="menu_copy">Kopieren</string>
|
<string name="menu_copy">Kopieren</string>
|
||||||
<string name="menu_edit">Bearbeiten</string>
|
<string name="menu_edit">Bearbeiten</string>
|
||||||
|
<string name="menu_preview">Vorschau</string>
|
||||||
<string name="menu_share">Teilen</string>
|
<string name="menu_share">Teilen</string>
|
||||||
<string name="menu_about">Über</string>
|
<string name="menu_about">Über</string>
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<string name="menu_delete">Delete</string>
|
<string name="menu_delete">Delete</string>
|
||||||
<string name="menu_copy">Copy</string>
|
<string name="menu_copy">Copy</string>
|
||||||
<string name="menu_edit">Edit</string>
|
<string name="menu_edit">Edit</string>
|
||||||
|
<string name="menu_preview">Preview</string>
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue