Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #109 from rey5137/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rey5137 committed May 19, 2015
2 parents de57877 + f6292fc commit 8217833
Show file tree
Hide file tree
Showing 20 changed files with 302 additions and 174 deletions.
4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Material.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
Expand All @@ -15,5 +16,4 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

</module>
6 changes: 3 additions & 3 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
Expand Down Expand Up @@ -92,5 +93,4 @@
<orderEntry type="library" exported="" name="cardview-v7-21.0.2" level="project" />
<orderEntry type="module" module-name="lib" exported="" />
</component>
</module>

</module>
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.rey.material.demo"
minSdkVersion 9
targetSdkVersion 21
versionCode 2
versionName "0.0.2"
versionCode 3
versionName "0.0.3"
}

signingConfigs {
Expand Down
62 changes: 31 additions & 31 deletions app/src/main/java/com/rey/material/demo/ButtonFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,37 +86,37 @@ public void onClick(View v) {
bt_float_color.setOnClickListener(listener_delay);
bt_float_wave_color.setOnClickListener(listener_delay);

bt_flat.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
RecurringPickerDialog.Builder builder = new RecurringPickerDialog.Builder(R.style.Material_App_Dialog_Light){
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
RecurringPickerDialog dialog = (RecurringPickerDialog)fragment.getDialog();
Toast.makeText(fragment.getActivity(), dialog.getRecurring().toString(), Toast.LENGTH_LONG).show();
fragment.dismiss();
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getActivity(), "Cancelled", Toast.LENGTH_SHORT).show();
fragment.dismiss();
}
};
Recurring recurring = new Recurring();
recurring.setStartTime(System.currentTimeMillis());
recurring.setRepeatMode(Recurring.REPEAT_WEEKLY);
recurring.setEnabledWeekday(Calendar.SUNDAY, true);
recurring.setEnabledWeekday(Calendar.TUESDAY, true);
builder.recurring(recurring)
.datePickerLayoutStyle(R.style.Material_App_Dialog_DatePicker_Light)
.positiveAction("OK")
.negativeAction("CANCEL");

DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getFragmentManager(), null);
}
});
// bt_flat.setOnClickListener(new View.OnClickListener(){
// @Override
// public void onClick(View v) {
// RecurringPickerDialog.Builder builder = new RecurringPickerDialog.Builder(R.style.Material_App_Dialog_Light){
// @Override
// public void onPositiveActionClicked(DialogFragment fragment) {
// RecurringPickerDialog dialog = (RecurringPickerDialog)fragment.getDialog();
// Toast.makeText(fragment.getActivity(), dialog.getRecurring().toString(), Toast.LENGTH_LONG).show();
// fragment.dismiss();
// }
//
// @Override
// public void onNegativeActionClicked(DialogFragment fragment) {
// Toast.makeText(fragment.getActivity(), "Cancelled", Toast.LENGTH_SHORT).show();
// fragment.dismiss();
// }
// };
// Recurring recurring = new Recurring();
// recurring.setStartTime(System.currentTimeMillis());
// recurring.setRepeatMode(Recurring.REPEAT_WEEKLY);
// recurring.setEnabledWeekday(Calendar.SUNDAY, true);
// recurring.setEnabledWeekday(Calendar.TUESDAY, true);
// builder.recurring(recurring)
// .datePickerLayoutStyle(R.style.Material_App_Dialog_DatePicker_Light)
// .positiveAction("OK")
// .negativeAction("CANCEL");
//
// DialogFragment fragment = DialogFragment.newInstance(builder);
// fragment.show(getFragmentManager(), null);
// }
// });

return v;
}
Expand Down
46 changes: 25 additions & 21 deletions app/src/main/java/com/rey/material/demo/DialogsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public static DialogsFragment newInstance(){
return fragment;
}

private MainActivity mActivity;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand Down Expand Up @@ -55,6 +57,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
bt_time_dark.setOnClickListener(this);
bt_date_dark.setOnClickListener(this);

mActivity = (MainActivity)getActivity();

return v;
}

Expand All @@ -77,13 +81,13 @@ public void onClick(View v) {
builder = new SimpleDialog.Builder(R.style.SimpleDialogLight){
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Discarded", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Discarded", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Canceled", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Canceled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -96,13 +100,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
builder = new SimpleDialog.Builder(R.style.SimpleDialog){
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Deleted", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Deleted", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -115,13 +119,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
builder = new SimpleDialog.Builder(R.style.SimpleDialogLight){
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Agreed", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Agreed", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Disagreed", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Disagreed", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -142,13 +146,13 @@ protected void onBuildDone(Dialog dialog) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
EditText et_pass = (EditText)fragment.getDialog().findViewById(R.id.custom_et_password);
Toast.makeText(fragment.getDialog().getContext(), "Connected. pass=" + et_pass.getText().toString(), Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Connected. pass=" + et_pass.getText().toString(), Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -162,13 +166,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
builder = new SimpleDialog.Builder(R.style.SimpleDialogLight){
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "You have selected " + getSelectedValue() + " as phone ringtone.", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "You have selected " + getSelectedValue() + " as phone ringtone.", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled" , Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -184,20 +188,20 @@ public void onNegativeActionClicked(DialogFragment fragment) {
public void onPositiveActionClicked(DialogFragment fragment) {
CharSequence[] values = getSelectedValues();
if(values == null)
Toast.makeText(fragment.getDialog().getContext(), "You have selected nothing.", Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "You have selected nothing.", Toast.LENGTH_SHORT).show();
else{
StringBuffer sb = new StringBuffer();
sb.append("You have selected ");
for(int i = 0; i < values.length; i++)
sb.append(values[i]).append(i == values.length - 1? "." : ", ");
Toast.makeText(fragment.getDialog().getContext(), sb.toString(), Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, sb.toString(), Toast.LENGTH_SHORT).show();
}
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled" , Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -212,13 +216,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
TimePickerDialog dialog = (TimePickerDialog)fragment.getDialog();
Toast.makeText(fragment.getDialog().getContext(), "Time is " + dialog.getFormattedTime(SimpleDateFormat.getTimeInstance()), Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Time is " + dialog.getFormattedTime(SimpleDateFormat.getTimeInstance()), Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled" , Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -232,13 +236,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
public void onPositiveActionClicked(DialogFragment fragment) {
DatePickerDialog dialog = (DatePickerDialog)fragment.getDialog();
String date = dialog.getFormattedDate(SimpleDateFormat.getDateInstance());
Toast.makeText(fragment.getDialog().getContext(), "Date is " + date, Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Date is " + date, Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled" , Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -251,13 +255,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
TimePickerDialog dialog = (TimePickerDialog)fragment.getDialog();
Toast.makeText(fragment.getDialog().getContext(), "Time is " + dialog.getFormattedTime(SimpleDateFormat.getTimeInstance()), Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Time is " + dialog.getFormattedTime(SimpleDateFormat.getTimeInstance()), Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled" , Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand All @@ -271,13 +275,13 @@ public void onNegativeActionClicked(DialogFragment fragment) {
public void onPositiveActionClicked(DialogFragment fragment) {
DatePickerDialog dialog = (DatePickerDialog)fragment.getDialog();
String date = dialog.getFormattedDate(SimpleDateFormat.getDateInstance());
Toast.makeText(fragment.getDialog().getContext(), "Date is " + date, Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Date is " + date, Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}

@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(fragment.getDialog().getContext(), "Cancelled" , Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
Spinner spn_no_arrow = (Spinner)v.findViewById(R.id.spinner_no_arrow);
String[] items = new String[20];
for(int i = 0; i < items.length; i++)
items[i] = String.valueOf(i + 1);
items[i] = "Item " + String.valueOf(i + 1);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.row_spn, items);
adapter.setDropDownViewResource(R.layout.row_spn_dropdown);
spn_label.setAdapter(adapter);
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=1.1.1-SNAPSHOT
VERSION_NAME=1.1.1
VERSION_CODE=5
GROUP=com.github.rey5137

Expand Down
6 changes: 3 additions & 3 deletions lib/lib.iml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
Expand Down Expand Up @@ -94,5 +95,4 @@
<orderEntry type="library" exported="" name="appcompat-v7-21.0.2" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.2" level="project" />
</component>
</module>

</module>
Loading

0 comments on commit 8217833

Please sign in to comment.