Skip to content

Field names should comply with a naming convention #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public class MainActivity

NotificationManager notificationManager;
private String icon;
private int saved_id;
private String share_info;
private int savedId;
private String shareInfo;
private boolean useAlarm = false;
private Calendar reminderCalendar;
private Toolbar mToolbar;
Expand Down Expand Up @@ -113,9 +113,9 @@ public void onCreate(Bundle savedInstanceState){

//EDIT NOTIF
try {
saved_id = saved.getInt("id",-1);
savedId = saved.getInt("id",-1);
} catch(Exception e){
saved_id = -1;
savedId = -1;
}

//RECEIVER INTENT
Expand All @@ -129,7 +129,7 @@ public void onCreate(Bundle savedInstanceState){
if ("text/plain".equals(type)) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
if (sharedText != null) {
share_info = sharedText;
shareInfo = sharedText;
}
}
} else if(("com.google.android.gm.action.AUTO_SEND").equals(action) && type != null) {
Expand All @@ -156,9 +156,9 @@ public void onCreate(Bundle savedInstanceState){
}

private void autoSaveNote(String sharedText) {
share_info = sharedText;
shareFields(share_info);
icon = "checkmark_gray";
shareInfo = sharedText;
shareFields(shareInfo);
icon = "checkmarkGray";
addBtn(null);
}
private void shareFields(String share_info){
Expand All @@ -170,7 +170,7 @@ private void updateFields() {
//
NotificationDataSource datasource = new NotificationDataSource(this);
datasource.open();
NotificationItem item = datasource.getItem(saved_id);
NotificationItem item = datasource.getItem(savedId);
datasource.close();
//Log.i(TAG, item.getLongText());
final EditText editText = (EditText) findViewById(R.id.entryText);
Expand All @@ -185,17 +185,17 @@ private void updateFields() {
resetBkg();
icon = item.getIcon();

if(icon.equals("checkmark_gray")) {
checkmark_gray.setSelected(true);
if(icon.equals("checkmarkGray")) {
checkmarkGray.setSelected(true);
}
if(icon.equals("checkmark_orange")) {
checkmark_orange.setSelected(true);
if(icon.equals("checkmarkOrange")) {
checkmarkOrange.setSelected(true);
}
if(icon.equals("checkmark_red")) {
checkmark_red.setSelected(true);
if(icon.equals("checkmarkRed")) {
checkmarkRed.setSelected(true);
}
if(icon.equals("checkmark_green")) {
checkmark_green.setSelected(true);
if(icon.equals("checkmarkGreen")) {
checkmarkGreen.setSelected(true);
}

//Create the reminder time calendar object according to last saved time
Expand All @@ -204,8 +204,8 @@ private void updateFields() {
//Show it
dateBtn.setText(DateFormat.getDateFormat(this).format(reminderCalendar.getTime()));
TimeBtn.setText(DateFormat.getTimeFormat(this).format(reminderCalendar.getTime()));
reminder_set.setVisibility(View.VISIBLE);
reminder_none.setVisibility(View.GONE);
reminderSet.setVisibility(View.VISIBLE);
reminderNone.setVisibility(View.GONE);
useAlarm = true;
}

Expand All @@ -232,8 +232,8 @@ public void addBtn(View v) {
Log.d(TAG, firstLine);

String longText;
if (share_info != null)
longText = share_info;
if (shareInfo != null)
longText = shareInfo;
else if (lineBreakPos != -1)
longText = inputText.substring(lineBreakPos + 1);
else
Expand All @@ -252,8 +252,8 @@ else if (lineBreakPos != -1)
} */

//Delete old notif if editing
if(saved_id != -1){
mBundle.putInt("old_noif_id", saved_id);
if(savedId != -1){
mBundle.putInt("old_noif_id", savedId);
}
if(useAlarm){
//Pass the calendar object to the intent bundle
Expand Down Expand Up @@ -306,11 +306,11 @@ public boolean onMenuItemClick(MenuItem item) {
// Inflate a menu to be displayed in the toolbar
mToolbar.inflateMenu(R.menu.activity_main);

//icon = "checkmark_gray";
//icon = "checkmarkGray";
addBtn.setEnabled(false);
addBtn.setClickable(false);
checkmark_gray.setSelected(true);
icon = "checkmark_gray";
checkmarkGray.setSelected(true);
icon = "checkmarkGray";
// Request focus and show soft keyboard automatically
editText.requestFocus();
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
Expand Down Expand Up @@ -344,9 +344,9 @@ public void onTextChanged(CharSequence s, int start, int before, int count){}
});


if(share_info != null){
if(shareInfo != null){
Log.i(TAG, "Received an share intent...");
shareFields(share_info);
shareFields(shareInfo);
}

//Create the reminder time calendar object
Expand All @@ -359,8 +359,8 @@ public void onTextChanged(CharSequence s, int start, int before, int count){}
dateBtn.setText(DateFormat.getDateFormat(this).format(reminderCalendar.getTime()));
TimeBtn.setText(DateFormat.getTimeFormat(this).format(reminderCalendar.getTime()));

if(saved_id != -1){
Log.i(TAG, "Loading from database: " + saved_id);
if(savedId != -1){
Log.i(TAG, "Loading from database: " + savedId);
updateFields();
}
}
Expand Down Expand Up @@ -432,22 +432,22 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {


@ViewById
ImageButton checkmark_gray;
ImageButton checkmarkGray;

@ViewById
ImageButton checkmark_green;
ImageButton checkmarkGreen;

@ViewById
ImageButton checkmark_orange;
ImageButton checkmarkOrange;

@ViewById
ImageButton checkmark_red;
ImageButton checkmarkRed;

@ViewById
RelativeLayout reminder_set;
RelativeLayout reminderSet;

@ViewById
RelativeLayout reminder_none;
RelativeLayout reminderNone;

@Click
void dateBtn(){
Expand All @@ -464,48 +464,48 @@ void TimeBtn(){

@Click
void reminderAddBtn(){
reminder_set.setVisibility(View.VISIBLE);
reminder_none.setVisibility(View.GONE);
reminderSet.setVisibility(View.VISIBLE);
reminderNone.setVisibility(View.GONE);
useAlarm = true;
}
@Click
void cancelAlarmSet(){
reminder_set.setVisibility(View.GONE);
reminder_none.setVisibility(View.VISIBLE);
reminderSet.setVisibility(View.GONE);
reminderNone.setVisibility(View.VISIBLE);
useAlarm = false;
}

@Click
void checkmark_gray(){
resetBkg();
checkmark_gray.setSelected(true);
icon = "checkmark_gray";
checkmarkGray.setSelected(true);
icon = "checkmarkGray";
}

@Click
void checkmark_green(){
resetBkg();
checkmark_green.setSelected(true);
icon= "checkmark_green";
checkmarkGreen.setSelected(true);
icon= "checkmarkGreen";
}
@Click
void checkmark_orange(){
resetBkg();
checkmark_orange.setSelected(true);
icon= "checkmark_orange";
checkmarkOrange.setSelected(true);
icon= "checkmarkOrange";
}
@Click
void checkmark_red(){
resetBkg();
checkmark_red.setSelected(true);
icon= "checkmark_red";
checkmarkRed.setSelected(true);
icon= "checkmarkRed";
}

public void resetBkg(){
checkmark_gray.setSelected(false);
checkmark_green.setSelected(false);
checkmark_orange.setSelected(false);
checkmark_red.setSelected(false);
checkmarkGray.setSelected(false);
checkmarkGreen.setSelected(false);
checkmarkOrange.setSelected(false);
checkmarkRed.setSelected(false);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void setUpNextRun(NotificationItem notif) {

Bundle jBundle = new Bundle();
jBundle.putString("action", "alarm");
jBundle.putInt("id", notif._id);
jBundle.putInt("id", notif.id);
intent.putExtras(jBundle);

PendingIntent pendingIntent =
Expand All @@ -165,7 +165,7 @@ private void setUpNextRun(NotificationItem notif) {
}

Log.d("Notable", "Created alarm at: " + notif.getReminderTime());
Log.d("Notable", "with id: " + notif._id);
Log.d("Notable", "with id: " + notif.id);
}

private void finish() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CursorRecyclerViewAdapter(Context context, C cursor) {
mContext = context;
mCursor = cursor;
mDataValid = cursor != null;
mRowIdColumn = mDataValid ? mCursor.getColumnIndex("_id") : -1;
mRowIdColumn = mDataValid ? mCursor.getColumnIndex("id") : -1;
mDataSetObserver = new NotifyingDataSetObserver();
if (mCursor != null) {
mCursor.registerDataSetObserver(mDataSetObserver);
Expand Down Expand Up @@ -116,7 +116,7 @@ public Cursor swapCursor(C newCursor) {
if (mDataSetObserver != null) {
mCursor.registerDataSetObserver(mDataSetObserver);
}
mRowIdColumn = newCursor.getColumnIndexOrThrow("_id");
mRowIdColumn = newCursor.getColumnIndexOrThrow("id");
mDataValid = true;
notifyDataSetChanged();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public void updateItem(long rowId, String title, String longtext, String icon) {
args.put(SQLiteHelper.COLUMN_TIME, Calendar.getInstance().getTimeInMillis());
args.put(SQLiteHelper.COLUMN_ICON, icon);

database.update(SQLiteHelper.TABLE_NOTIFS, args, "_id=" + rowId, null);
database.update(SQLiteHelper.TABLE_NOTIFS, args, "id=" + rowId, null);
}

public void setDismissed(long rowId, boolean dismissed) {
ContentValues args = new ContentValues();
args.put(SQLiteHelper.COLUMN_DISMISSED, dismissed ? 1 : 0);
database.update(SQLiteHelper.TABLE_NOTIFS, args, "_id=" + rowId, null);
database.update(SQLiteHelper.TABLE_NOTIFS, args, "id=" + rowId, null);

//broadcast db change
Intent intent = new Intent();
Expand Down Expand Up @@ -159,7 +159,7 @@ public void dismissItem(int id) {
class SQLiteHelper extends SQLiteOpenHelper {

public static final String TABLE_NOTIFS = "NOTIF";
public static final String COLUMN_ID = "_id";
public static final String COLUMN_ID = "id";
public static final String COLUMN_TITLE = "title";
public static final String COLUMN_LONGTEXT = "longtext";
public static final String COLUMN_ICON = "icon";
Expand Down
Loading