Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

Commit 72f9c04

Browse files
committed
Implemented #74
1 parent 8cfb1d7 commit 72f9c04

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

app/app.iml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@
100100
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
101101
<orderEntry type="library" exported="" name="glide-3.6.1" level="project" />
102102
<orderEntry type="library" exported="" name="material-dialogs-0.7.9.1" level="project" />
103-
<orderEntry type="library" exported="" name="robospice-cache-1.4.14" level="project" />
103+
<orderEntry type="library" exported="" name="robospice-1.4.14" level="project" />
104104
<orderEntry type="library" exported="" name="commons-io-1.3.2" level="project" />
105+
<orderEntry type="library" exported="" name="robospice-cache-1.4.14" level="project" />
105106
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
106-
<orderEntry type="library" exported="" name="robospice-1.4.14" level="project" />
107107
<orderEntry type="module" module-name="imagepicker" exported="" />
108108
</component>
109109
</module>

imagepicker/imagepicker.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@
9393
<orderEntry type="library" exported="" name="eventbus-2.4.0" level="project" />
9494
<orderEntry type="library" exported="" name="design-23.0.0" level="project" />
9595
<orderEntry type="library" exported="" name="floatingactionbutton-1.3.0" level="project" />
96+
<orderEntry type="library" exported="" name="robospice-1.4.14" level="project" />
9697
<orderEntry type="library" exported="" name="commons-io-1.3.2" level="project" />
9798
<orderEntry type="library" exported="" name="robospice-cache-1.4.14" level="project" />
98-
<orderEntry type="library" exported="" name="robospice-1.4.14" level="project" />
9999
<orderEntry type="library" exported="" name="appcompat-v7-23.0.0" level="project" />
100100
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.0" level="project" />
101101
<orderEntry type="library" exported="" name="library-1.2.3" level="project" />

imagepicker/src/main/java/net/yazeed44/imagepicker/ui/PickerActivity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ private void initActionbar(final Bundle savedInstanceState) {
133133

134134

135135
if (savedInstanceState == null) {
136-
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
136+
mShouldShowUp = mPickOptions.backBtnInMainActivity;
137+
getSupportActionBar().setDisplayHomeAsUpEnabled(mPickOptions.backBtnInMainActivity);
137138
getSupportActionBar().setTitle(R.string.albums_title);
138139
} else {
139140
mShouldShowUp = savedInstanceState.getBoolean(KEY_SHOULD_SHOW_ACTIONBAR_UP);
140-
getSupportActionBar().setDisplayHomeAsUpEnabled(mShouldShowUp);
141+
getSupportActionBar().setDisplayHomeAsUpEnabled(mShouldShowUp && mPickOptions.backBtnInMainActivity);
141142
getSupportActionBar().setTitle(savedInstanceState.getString(KEY_ACTION_BAR_TITLE));
142143

143144

@@ -457,7 +458,7 @@ public void onBackPressed() {
457458
//Return to albums fragment
458459
getSupportFragmentManager().popBackStack();
459460
getSupportActionBar().setTitle(R.string.albums_title);
460-
mShouldShowUp = false;
461+
mShouldShowUp = mPickOptions.backBtnInMainActivity;
461462
getSupportActionBar().setDisplayHomeAsUpEnabled(mShouldShowUp);
462463
hideSelectAll();
463464
hideDeselectAll();

imagepicker/src/main/java/net/yazeed44/imagepicker/util/Picker.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public final class Picker {
4141
public final int doneFabIconTintColor;
4242
public final boolean shouldShowCaptureMenuItem;
4343
public final int checkIconTintColor;
44+
public final boolean backBtnInMainActivity;
4445

4546

4647
private Picker(final Builder builder) {
@@ -63,6 +64,7 @@ private Picker(final Builder builder) {
6364
doneFabIconTintColor = builder.mDoneFabIconTintColor;
6465
shouldShowCaptureMenuItem = builder.mShouldShowCaptureMenuItem;
6566
checkIconTintColor = builder.mCheckIconTintColor;
67+
backBtnInMainActivity = builder.mBackBtnInMainActivity;
6668

6769

6870

@@ -112,6 +114,7 @@ public static class Builder {
112114
private int mCaptureItemIconTintColor;
113115
private boolean mShouldShowCaptureMenuItem;
114116
private int mCheckIconTintColor;
117+
private boolean mBackBtnInMainActivity;
115118

116119

117120
//Use (Context,PickListener,themeResId) instead
@@ -252,6 +255,11 @@ public Picker.Builder setCheckIconTintColor(@ColorInt final int color) {
252255
return this;
253256
}
254257

258+
public Picker.Builder setBackBtnInMainActivity(final boolean backBtn) {
259+
mBackBtnInMainActivity = backBtn;
260+
return this;
261+
}
262+
255263

256264
public Picker build() {
257265
return new Picker(this);

0 commit comments

Comments
 (0)