Skip to content

Commit

Permalink
Merge pull request #133 from jrvansuita/minor_improvements
Browse files Browse the repository at this point in the history
Set default title for Gallery & Camera Intent Chooser
  • Loading branch information
yogeshpaliyal committed Nov 22, 2020
2 parents c3f4074 + d060e71 commit eedb60e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Library Logo -->
<img src="https://github.com/jrvansuita/PickImage/blob/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png?raw=true" align="left" hspace="1" vspace="1">

<!-- Buy me a cup of coffe -->
<!-- Buy me a cup of coffee -->
<a href='https://ko-fi.com/A406JCM' style='margin:13px;' target='_blank' align="right"><img align="right" height='36' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' alt='Buy Me a Coffee at ko-fi.com' /></a>
<a href='https://play.google.com/store/apps/details?id=com.vansuita.pickimage.sample&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1' target='_blank' align="right"><img align="right" height='36' src='https://s20.postimg.org/muzx3w4jh/google_play_badge.png' alt='Get it on Google Play' /></a>
# PickImage
Expand Down Expand Up @@ -136,15 +136,17 @@ PickSetup setup = new PickSetup()
.setButtonTextColor(yourColor)
.setDimAmount(yourFloat)
.setFlip(true)
.setMaxSize(500)
.setMaxSize
.setPickTypes(EPickType.GALLERY, EPickType.CAMERA)
.setCameraButtonText(yourText)
.setGalleryButtonText(yourText)
.setIconGravity(Gravity.LEFT)
.setButtonOrientation(LinearLayoutCompat.VERTICAL)
.setSystemDialog(false)
.setGalleryIcon(yourIcon)
.setCameraIcon(yourIcon);
.setCameraIcon(yourIcon)
.setGalleryChooserTitle(yourText)
.setCameraChooserTitle(yourText);
/*... and more to come. */
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ protected void customize(PickSetup setup) {
setup.setButtonOrientationInt(getNum(R.string.key_buttons_orientation));
setup.setSystemDialog(getBool(R.string.key_system_dialog));

setup.setCameraChooserTitle(getStr(R.string.key_title_camera_intent_chooser));
setup.setGalleryChooserTitle(getStr(R.string.key_title_gallery_intent_chooser));

//setup.setWidth(800).setHeight(700);
//setup.setVideo(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
@Override
protected void onImageViewClick() {
PickSetup setup = new PickSetup();

super.customize(setup);

PickImageDialog.build(setup)
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<string name="cancel_text">Cancel Button Text</string>
<string name="camera_button_text">Camera Button Text</string>
<string name="gallery_button_text">Gallery Button Text</string>
<string name="camera_intent_chooser_title">Camera Intent Chooser Title</string>
<string name="gallery_intent_chooser_title">Gallery Intent Chooser Title</string>
<string name="background_color">Dialog Background Color</string>
<string name="title_color">Dialog Title Color</string>
<string name="button_text_color">Buttons Text Color</string>
Expand Down Expand Up @@ -45,4 +47,6 @@
<string name="key_providers">key_providers</string>
<string name="key_buttons_orientation">key_buttons_orientation</string>
<string name="key_icon_gravity">key_icon_gravity</string>
<string name="key_title_camera_intent_chooser">key_title_camera_intent_chooser</string>
<string name="key_title_gallery_intent_chooser">key_title_gallery_intent_chooser</string>
</resources>
13 changes: 13 additions & 0 deletions app/src/main/res/xml/prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@
android:summary="@string/provide_text"
android:title="@string/gallery_button_text" />


<EditTextPreference
android:defaultValue="@string/default_camera_chooser_title"
android:key="@string/key_title_camera_intent_chooser"
android:summary="@string/provide_text"
android:title="@string/camera_intent_chooser_title" />

<EditTextPreference
android:defaultValue="@string/default_gallery_chooser_title"
android:key="@string/key_title_gallery_intent_chooser"
android:summary="@string/provide_text"
android:title="@string/gallery_intent_chooser_title" />

</PreferenceCategory>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,18 @@ public String getGalleryChooserTitle() {
return galleryChooserTitle;
}

public void setGalleryChooserTitle(String galleryChooserTitle) {
public PickSetup setGalleryChooserTitle(String galleryChooserTitle) {
this.galleryChooserTitle = galleryChooserTitle;
return this;
}

public String getCameraChooserTitle() {
return cameraChooserTitle;
}

public void setCameraChooserTitle(String cameraChooserTitle) {
public PickSetup setCameraChooserTitle(String cameraChooserTitle) {
this.cameraChooserTitle = cameraChooserTitle;
return this;
}

public PickSetup() {
Expand All @@ -322,6 +324,8 @@ public PickSetup() {
.setMaxSize(300)
.setWidth(0)
.setHeight(0)
.setGalleryChooserTitle("Pick from")
.setCameraChooserTitle("Capture using")
.setPickTypes(EPickType.CAMERA, EPickType.GALLERY)
.setProgressText("Loading...")
.setButtonOrientation(LinearLayout.VERTICAL)
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<resources>
<string name="app_name">Library</string>
<string name="camera">Camera</string>
<string name="default_camera_chooser_title">Capture using</string>
<string name="default_gallery_chooser_title">Pick using</string>
<string name="gallery">Gallery</string>
<string name="choose">Choose</string>
<string name="cancel">Cancel</string>
Expand Down

0 comments on commit eedb60e

Please sign in to comment.