Skip to content

Commit

Permalink
ADD Ok button in Select year dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
alhazmy13 committed Feb 10, 2016
1 parent b33d67b commit 6cc17c3
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ You can report any issue on issues page. **Note: If you speak Arabic, you can su
<dependency>
<groupId>net.alhazmy13.hijridatepicker</groupId>
<artifactId>libary</artifactId>
<version>1.3.0</version>
<version>1.3.1</version>
</dependency>
```
**Gradle**
```gradle
dependencies {
compile 'net.alhazmy13.hijridatepicker:libary:1.3.0'
compile 'net.alhazmy13.hijridatepicker:libary:1.3.1'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import net.alhazmy13.hijridatepicker.HijriCalendarDialog;
import net.alhazmy13.hijridatepicker.HijriCalendarView;

Expand All @@ -18,13 +19,17 @@ protected void onCreate(Bundle savedInstanceState) {
((Button) findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {


new HijriCalendarDialog.Builder(MainActivity.this)
.setOnDateSetListener(MainActivity.this)
.setMinMaxHijriYear(1430,1450)
.setMinMaxGregorianYear(2013,2020)
.setUILanguage(HijriCalendarDialog.Language.English)
.setMode(HijriCalendarDialog.Mode.Gregorian)
.setMode(HijriCalendarDialog.Mode.Hijri)
.show();


}
});

Expand Down
2 changes: 1 addition & 1 deletion libary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ext {
siteUrl = 'https://github.com/alhzmy13/HijriDatePicker'
gitUrl = 'https://github.com/alhzmy13/HijriDatePicker.git'

libraryVersion = '1.3.0'
libraryVersion = '1.3.1'

developerId = 'alhazmy13'
developerName = 'Abdullah Alhazmy'
Expand Down
16 changes: 8 additions & 8 deletions libary/libary.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":libary" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="net.alhazmy13.hijridatepicker" external.system.module.version="1.3.0" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":libary" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="net.alhazmy13.hijridatepicker" external.system.module.version="1.3.1" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down Expand Up @@ -62,20 +62,20 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.NumberPicker;
Expand All @@ -19,11 +20,13 @@

/**
* Created by Alhazmy13 on 1/6/16.
* HijriDatePicker
*/
class YearDialog extends Dialog implements DialogInterface.OnDismissListener {
class YearDialog extends Dialog implements DialogInterface.OnDismissListener,View.OnClickListener {
private Context mContext;
private NumberPicker numberPicker;
private OnYearChanged onYearChanged;
private Button okButton;
private int year;


Expand Down Expand Up @@ -54,6 +57,8 @@ public YearDialog(Context context) {

private void initViews() {
numberPicker = (NumberPicker) findViewById(R.id.numberPicker);
okButton = (Button) findViewById(R.id.okBT);
okButton.setOnClickListener(this);
}

protected void setTitle(String title){
Expand All @@ -68,4 +73,11 @@ public void onDismiss(DialogInterface dialogInterface) {
public void setYear(int year) {
this.numberPicker.setValue(year);
}

@Override
public void onClick(View view) {
onYearChanged.onYearChanged(numberPicker.getValue());
dismiss();
}

}
20 changes: 20 additions & 0 deletions libary/src/main/res/layout/dialog_year.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,24 @@
android:layout_height="wrap_content"
android:id="@+id/numberPicker" />

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout"
android:gravity="right"
android:layout_below="@+id/calendarTableLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" >

<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hijri_date_picker_done"
android:id="@+id/okBT"
android:backgroundTint="@color/hijri_date_picker_accent_color"
android:textColor="#FFFFFF" />
</LinearLayout>

</LinearLayout>

0 comments on commit 6cc17c3

Please sign in to comment.