Skip to content

Commit

Permalink
Merge pull request #4 from gzeinnumer/textstyle
Browse files Browse the repository at this point in the history
Textstyle
  • Loading branch information
gzeinnumer authored Nov 17, 2021
2 parents e595a20 + 8c0b69e commit 7d6b990
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

5 changes: 2 additions & 3 deletions .idea/gradle.xml

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

9 changes: 8 additions & 1 deletion .idea/misc.xml

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

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</h1>

<div align="center">
<a><img src="https://img.shields.io/badge/Version-3.3.0-brightgreen.svg?style=flat"></a>
<a><img src="https://img.shields.io/badge/Version-3.3.1-brightgreen.svg?style=flat"></a>
<a><img src="https://img.shields.io/badge/ID-gzeinnumer-blue.svg?style=flat"></a>
<a><img src="https://img.shields.io/badge/Java-Suport-green?logo=java&style=flat"></a>
<a><img src="https://img.shields.io/badge/Kotlin-Suport-green?logo=kotlin&style=flat"></a>
Expand Down Expand Up @@ -545,6 +545,8 @@ new TimeDialog(getSupportFragmentManager())
- Bug Fixing
- **3.3.0**
- Remove Space From Button
- **3.3.1**
- Add CharSequence to Title and Content

---
# Contribution
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ dependencies {

implementation 'com.google.android.material:material:1.3.0'
api 'com.agrawalsuneet.androidlibs:dotsloader:1.4'
implementation 'com.github.gzeinnumer:SimpleMaterialStyle:2.2.1'
implementation 'com.github.gzeinnumer:SimpleMaterialStyle:2.3.3'
implementation 'com.github.gzeinnumer:EasySpannableText:1.0.1'

implementation project(':da')
}
36 changes: 28 additions & 8 deletions app/src/main/java/com/gzeinnumer/dialogandroid/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gzeinnumer.dialogandroid;

import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
Expand All @@ -8,6 +9,7 @@
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.google.android.material.timepicker.TimeFormat;
import com.gzeinnumer.da.constant.ButtonStyle;
Expand All @@ -20,14 +22,25 @@
import com.gzeinnumer.da.dialog.numberPicker.NumberPickerDialog;
import com.gzeinnumer.da.dialog.timePickerDialog.TimeDialog;
import com.gzeinnumer.da.dialog.timePickerDialog.callback.TimeDialogPositiveCallBack;
import com.gzeinnumer.est.SpannableBuilder;

public class MainActivity extends AppCompatActivity {

CharSequence sequence;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

int sizeInDp = 21;
int color = ContextCompat.getColor(this, R.color.purple_500);

sequence = new SpannableBuilder(getApplicationContext())
.text(Typeface.NORMAL,"NORMAL ")
.textColor(Typeface.BOLD,"BOLD ", color)
.textSize(Typeface.ITALIC,"ITALIC ", sizeInDp)
.textSizeColor(Typeface.BOLD_ITALIC,"BOLD_ITALIC ", sizeInDp, color)
.build();

confirmDialog();
infoDialog();
numberPickerDialog();
Expand All @@ -40,7 +53,8 @@ protected void onCreate(Bundle savedInstanceState) {
private void confirmDialog() {
findViewById(R.id.ConfirmDialog).setOnClickListener(v -> new ConfirmDialog(getSupportFragmentManager())
.setTitle("ini title")
.setContent("ini content")
// .setContent("ini content")
.setContent(sequence)
.onCancelPressedCallBack(() -> Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show())
.onOkPressedCallBack(() -> Toast.makeText(MainActivity.this, "Ok", Toast.LENGTH_SHORT).show())
.show());
Expand All @@ -58,7 +72,8 @@ private void infoDialog() {
// .setButtonColor(getResources().getColor(R.color.colorPrimary))
.setDialogType(DialogType.DialogSuccess)
.setTitle("ini title")
.setContent("ini content")
// .setContent("ini content")
.setContent(sequence)
.onOkPressedCallBack(() -> Toast.makeText(MainActivity.this, "Ok", Toast.LENGTH_SHORT).show())
.show());
}
Expand All @@ -67,7 +82,8 @@ private void numberPickerDialog() {
findViewById(R.id.NumberPickerDialog).setOnClickListener(v -> new NumberPickerDialog(getSupportFragmentManager())
.setLastValue(12)
.setTitle("ini title")
.setContent("ini content")
// .setContent("ini content")
.setContent(sequence)
.onOkPressedCallBack(value -> Toast.makeText(MainActivity.this, "Nilai nya " + value, Toast.LENGTH_SHORT).show())
.onCancelPressedCallBack(() -> Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show())
.show());
Expand All @@ -76,7 +92,8 @@ private void numberPickerDialog() {
private void loadingDialog() {
findViewById(R.id.LoadingDialog).setOnClickListener(v -> {
LoadingDialog loadingDialog = new LoadingDialog(getSupportFragmentManager())
.setContent("ini content");
// .setContent("ini content")
.setContent(sequence);

loadingDialog.show();

Expand All @@ -87,7 +104,8 @@ private void loadingDialog() {
private void singleDatePickerDialog() {
findViewById(R.id.SingleDatePickerDialog).setOnClickListener(v -> new SingleDatePickerDialog(getSupportFragmentManager())
.setTimeZone("GMT")
.setTitle("Pilih tanggal")
// .setTitle("Pilih tanggal")
.setTitle(sequence)
.setSelectedToday(true)
.setTimeFormat("dd/MM/yyyy") //pastikan polanya sama
.setStartDate("1/08/2020") //pastikan polanya sama
Expand All @@ -100,7 +118,8 @@ private void singleDatePickerDialog() {
private void multiDatePickerDialog() {
findViewById(R.id.MultiDatePickerDialog).setOnClickListener(v -> new MultiDatePickerDialog(getSupportFragmentManager())
.setTimeZone("GMT")
.setTitle("Pilih tanggal")
// .setTitle("Pilih tanggal")
.setTitle(sequence)
.setTimeFormat("dd/MM/yyyy") //pastikan 3 pola ini sama
.setStartDate("1/08/2020") //pastikan 3 pola ini sama
.setEndDate("31/12/2020") //pastikan 3 pola ini sama
Expand All @@ -111,7 +130,8 @@ private void multiDatePickerDialog() {

private void timeDialog() {
findViewById(R.id.TimeDialog).setOnClickListener(v -> new TimeDialog(getSupportFragmentManager())
.setTitle("Time")
// .setTitle("Time")
.setTitle(sequence)
.setHour(17)
.setMinute(17)
.setTimeFormat(TimeFormat.CLOCK_24H)
Expand Down
3 changes: 2 additions & 1 deletion da/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'com.github.gzeinnumer:SimpleMaterialStyle:2.2.3-alpha5'
implementation 'com.github.gzeinnumer:EasySpannableText:1.0.1'
implementation 'com.github.gzeinnumer:SimpleMaterialStyle:2.3.3'
implementation 'com.google.android.material:material:1.4.0'
api 'com.agrawalsuneet.androidlibs:dotsloader:1.4'
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public ConfirmDialog setDialogCanvas(Drawable resource) {

//TITLE
public ConfirmDialog setTitle(String title) {
this.tvTitleValue = (CharSequence) title;
return this;
}

public ConfirmDialog setTitle(CharSequence title) {
this.tvTitleValue = title;
return this;
}
Expand All @@ -61,8 +66,13 @@ public ConfirmDialog setTitleAlignment(int alignment) {
}

//CONTENT
public ConfirmDialog setContent(String title) {
this.tvContentValue = title;
public ConfirmDialog setContent(String content) {
this.tvContentValue = (CharSequence) content;
return this;
}

public ConfirmDialog setContent(CharSequence content) {
this.tvContentValue = content;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class ConfirmDialogSetting extends BaseDialog {
protected int buttonCancelColor = 0;
protected boolean buttonAllCaps = true;
protected ButtonStyle btnStyle;
protected String tvTitleValue;
protected String tvContentValue;
protected CharSequence tvTitleValue;
protected CharSequence tvContentValue;
protected String dBtnCancelValue;
protected String dBtnOkValue;
protected Drawable shapeCanvas = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public MultiDatePickerDialog(FragmentManager context) {

//TITLE
public MultiDatePickerDialog setTitle(String title) {
this.tvTitleValue = (CharSequence)title;
return this;
}

public MultiDatePickerDialog setTitle(CharSequence title) {
this.tvTitleValue = title;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MultiDatePickerDialogSetting {
protected MaterialDatePicker.Builder builder;
protected MaterialDatePicker<Pair<Long, Long>> materialDatePicker;

protected String tvTitleValue;
protected CharSequence tvTitleValue;
protected String timeZone = "GMT";

protected Calendar calendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public SingleDatePickerDialog(FragmentManager context) {

//TITLE
public SingleDatePickerDialog setTitle(String title) {
this.tvTitleValue = (CharSequence)title;
return this;
}

public SingleDatePickerDialog setTitle(CharSequence title) {
this.tvTitleValue = title;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SingleDatePickerDialogSetting {
protected MaterialDatePicker.Builder builder;
protected MaterialDatePicker materialDatePicker;

protected String tvTitleValue;
protected CharSequence tvTitleValue;
protected String timeZone = "GMT";

protected Calendar calendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public InfoDialog setTitle(String title) {
return this;
}

public InfoDialog setTitle(CharSequence title) {
this.tvTitleValue = (CharSequence)title;
return this;
}

public InfoDialog setTitleSize(int size) {
this.tvTitleSize = size;
return this;
Expand All @@ -62,8 +67,13 @@ public InfoDialog setTitleAlignment(int alignment) {
}

//CONTENT
public InfoDialog setContent(String title) {
this.tvContentValue = title;
public InfoDialog setContent(String content) {
this.tvContentValue = (CharSequence)content;
return this;
}

public InfoDialog setContent(CharSequence content) {
this.tvContentValue = content;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class InfoDialogSetting extends BaseDialog {
protected boolean buttonAllCaps = true;
protected ButtonStyle btnStyle;
protected DialogType dialogType = DialogType.DialogSuccess;
protected String tvTitleValue;
protected String tvContentValue;
protected CharSequence tvTitleValue;
protected CharSequence tvContentValue;
protected String dBtnOkValue;
protected Drawable shapeCanvas = null;
protected double tvTitleSize = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public LoadingDialog setDialogCanvas(Drawable resource) {

//CONTENT
public LoadingDialog setContent(String title) {
this.tvContentValue = (CharSequence)title;
return this;
}

public LoadingDialog setContent(CharSequence title) {
this.tvContentValue = title;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public class LoadingDialogSetting extends BaseDialog {

protected String tvContentValue;
protected CharSequence tvContentValue;
protected Drawable shapeCanvas = null;
protected double tvContentSize = 0;
protected int tvContentColor = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public NumberPickerDialog setTitle(String title) {
this.tvTitleValue = title;
return this;
}
public NumberPickerDialog setTitle(CharSequence title) {
this.tvTitleValue = (CharSequence)title;
return this;
}

public NumberPickerDialog setTitleSize(int size) {
this.tvTitleSize = size;
Expand All @@ -62,7 +66,11 @@ public NumberPickerDialog setTitleAlignment(int alignment) {

//CONTENT
public NumberPickerDialog setContent(String title) {
this.tvContentValue = title;
this.tvContentValue = (CharSequence)title;
return this;
}
public NumberPickerDialog setContent(CharSequence content) {
this.tvContentValue = content;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class NumberPickerDialogSetting extends BaseDialog {
protected int buttonCancelColor = 0;
protected boolean buttonAllCaps = true;
protected ButtonStyle btnStyle;
protected String tvTitleValue;
protected String tvContentValue;
protected CharSequence tvTitleValue;
protected CharSequence tvContentValue;
protected String dBtnOkValue;
protected String dBtnCancelValue;
protected Drawable shapeCanvas = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public TimeDialog(FragmentManager supportFragmentManager) {
}

public TimeDialog setTitle(String title) {
this.title = (CharSequence)title;
return this;
}

public TimeDialog setTitle(CharSequence title) {
this.title = title;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TimeDialogSetting {
protected FragmentManager supportFragmentManager;
protected MaterialTimePicker materialTimePicker;
protected TimeDialogPositiveCallBack timeValueResult;
protected String title = "Pick Time";
protected CharSequence title = "Pick Time";
protected int timeFormat = TimeFormat.CLOCK_24H;
protected int hour = 0;
protected int minute = 0;
Expand Down

0 comments on commit 7d6b990

Please sign in to comment.