Skip to content

Instantly share code, notes, and snippets.

View jddeep's full-sized avatar
:atom:
Finding the real purpose of life.

Jaideep Prasad jddeep

:atom:
Finding the real purpose of life.
View GitHub Profile
dependencies{
implementation .......................
.....................................
def lifecycle_version = "1.1.1"
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
}
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.afollestad.material-dialogs:core:0.9.0.1'
implementation 'com.afollestad.material-dialogs:commons:0.9.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.wdullaer:materialdatetimepicker:2.5.0'
timeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
NewItem.this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
false
);
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "";
shareBody += etNewTask.getText().toString();
if(!TextUtils.isEmpty(dateTextView.getText().toString())) {
shareBody += " by " + dateTextView.getText().toString();
if(!TextUtils.isEmpty(timeTextView.getText().toString())) {
shareBody += " " + timeTextView.getText().toString();
}
}
public enum Priority {
LOW("low", 2, Color.rgb(204, 214, 0)),
MEDIUM("medium", 1, Color.rgb(255, 170, 0)),
HIGH("high", 0, Color.rgb(255, 0, 0));
}
public static Date getDateFromString(String date) {
SimpleDateFormat sf = new SimpleDateFormat("M/dd/yyyy");
sf.setLenient(true);
try {
return sf.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingStart="@dimen/activity_main_left"
android:paddingEnd="@dimen/activity_main_right"
android:paddingTop="@dimen/activity_vertical_margin"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" >
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:paddingBottom="@dimen/activity_vertical_margin"
listView = (ListView) findViewById(R.id.lvDisplay);
listView.setAdapter(aToDoAdaptor);
findViewById(R.id.spkBtn).setOnClickListener(this);
imgTick = (ImageView)findViewById(R.id.imgTick);
fab = (FloatingActionButton) findViewById(R.id.fab);
spkBtn = (ImageView) findViewById(R.id.spkBtn);
editText = (EditText) findViewById(R.id.etAddText);