Skip to content

Commit

Permalink
Merge branch 'master' into FDroid
Browse files Browse the repository at this point in the history
  • Loading branch information
k3b committed Apr 19, 2017
2 parents 4292d91 + 70b3263 commit 3a81767
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ android {
// 0.6.0.170315 (26) Bugfix for new Tag support (fdroid build failed)
// 0.6.0.170402 (27) language updates. (fdroid build failed)
// 0.6.0.170404 (28) same as 0.6.0.170402. try to fix fdroid build
// 0.6.0.170420 (29) bugfix Map
// 0.6.0.170421 (29) bugfix Map

versionCode = 29
versionName = '0.6.0.170420'
versionName = '0.6.0.170421'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ public void setCurrentFilterSettings(IGalleryFilter newFilterSettings) {

private BookmarkController mBookmarkController = null;

/**
* shows a new instance of FotoGalleryActivity.
*
* @param context calling activity
* @param filter if != null set initial filter to new FotoGalleryActivity
* @param query if != null set initial filter to new FotoGalleryActivity
* @param requestCode if != 0 start for result. else start without result
*/
public static void showActivity(Activity context, GalleryFilterParameter filter, QueryParameter query, int requestCode) {
Intent intent = new Intent(context, FotoGalleryActivity.class);

Expand Down Expand Up @@ -747,15 +755,15 @@ private void openFilter() {
GalleryFilterActivity.showActivity(this,
this.mGalleryQueryParameter.getCurrentFilterSettings(),
this.mGalleryQueryParameter.mGalleryContentQuery,
mBookmarkController.getlastBookmarkFileName());
mBookmarkController.getlastBookmarkFileName(), GalleryFilterActivity.resultID);
}

/** called by Fragment: a fragment Item was clicked */
@Override
public void onGalleryImageClick(long imageId, Uri imageUri, int position) {
Global.debugMemory(mDebugPrefix, "onGalleryImageClick");
QueryParameter imageDetailQuery = this.mGalleryQueryParameter.calculateEffectiveGalleryContentQuery();
ImageDetailActivityViewPager.showActivity(this, imageUri, position, imageDetailQuery);
ImageDetailActivityViewPager.showActivity(this, imageUri, position, imageDetailQuery, ImageDetailActivityViewPager.ACTIVITY_ID);
}

/** GalleryFragment tells the Owning Activity that querying data has finisched */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public class GalleryFilterActivity extends LocalizedActivity
private BookmarkController mBookmarkController = null;
private DialogFragment mDlg;

public static void showActivity(Activity context, IGalleryFilter filter, QueryParameter rootQuery, String lastBookmarkFileName) {
public static void showActivity(Activity context, IGalleryFilter filter, QueryParameter rootQuery,
String lastBookmarkFileName, int requestCode) {
mRootQuery = rootQuery;
if (Global.debugEnabled) {
Log.d(Global.LOG_CONTEXT, context.getClass().getSimpleName()
Expand All @@ -101,7 +102,11 @@ public static void showActivity(Activity context, IGalleryFilter filter, QueryPa
}

BookmarkController.saveState(lastBookmarkFileName, intent, null);
context.startActivityForResult(intent, resultID);
if (requestCode != 0) {
context.startActivityForResult(intent, requestCode);
} else {
context.startActivity(intent);
}
}

public static GalleryFilterParameter getFilter(Intent intent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ private boolean showPhoto(IDirectory selectedDir) {
QueryParameter query = new QueryParameter();
TagSql.filter2QueryEx(query, filter, true);
FotoSql.setSort(query, FotoSql.SORT_BY_DATE, false);
ImageDetailActivityViewPager.showActivity(this.getActivity(), null, 0, query);
ImageDetailActivityViewPager.showActivity(this.getActivity(), null, 0, query, 0);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ private boolean onGalleryLongImageClick(final GalleryCursorAdapter.GridCellViewH
multiSelectionUpdateActionbar("Start multisel");
} else {
// in gallery mode long click is view image
ImageDetailActivityViewPager.showActivity(this.getActivity(), getUri(holder.imageID), position, getCurrentQuery());
ImageDetailActivityViewPager.showActivity(this.getActivity(), getUri(holder.imageID), position, getCurrentQuery(), ImageDetailActivityViewPager.ACTIVITY_ID);
}
return true;
}
Expand Down Expand Up @@ -785,7 +785,7 @@ public boolean onOptionsItemSelected(MenuItem menuItem) {
MapGeoPickerActivity.showActivity(this.getActivity(), selectedFiles);
return true;
case R.id.cmd_edit_geo:
GeoEditActivity.showActivity(this.getActivity(), selectedFiles);
GeoEditActivity.showActivity(this.getActivity(), selectedFiles, GeoEditActivity.RESULT_ID);
return true;
case R.id.cmd_edit_tags: {
return tagsShowEditDialog(selectedFiles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,16 @@ protected Integer doInBackground(List<String>... params) {

}

public static void showActivity(Activity context, Uri imageUri, int position, QueryParameter imageDetailQuery) {
/**
* shows a new instance of ImageDetailActivityViewPager.
*
* @param context calling activity
* @param imageUri if != null initial image to show
* @param position offset of image to display in query or current file directory
* @param imageDetailQuery if != null set initial filter to new FotoGalleryActivity
* @param requestCode if != 0 start for result. else start without result
*/
public static void showActivity(Activity context, Uri imageUri, int position, QueryParameter imageDetailQuery, int requestCode) {
Intent intent;
//Create intent
intent = new Intent(context, ImageDetailActivityViewPager.class);
Expand All @@ -328,7 +337,11 @@ public static void showActivity(Activity context, Uri imageUri, int position, Qu
intent.putExtra(ImageDetailActivityViewPager.EXTRA_POSITION, position);
intent.setData(imageUri);

context.startActivityForResult(intent, ACTIVITY_ID);
if (requestCode != 0) {
context.startActivityForResult(intent, requestCode);
} else {
context.startActivity(intent);
}
}

@Override
Expand Down Expand Up @@ -837,9 +850,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
dirPath = FileUtils.getDir(dirPath).getAbsolutePath();
GalleryFilterParameter newFilter = new GalleryFilterParameter();
newFilter.setPath(dirPath);
int callBackId = (MediaScanner.isNoMedia(dirPath,MediaScanner.DEFAULT_SCAN_DEPTH)) ? NOMEDIA_GALLERY : 0;
// int callBackId = (MediaScanner.isNoMedia(dirPath,MediaScanner.DEFAULT_SCAN_DEPTH)) ? NOMEDIA_GALLERY : 0;

FotoGalleryActivity.showActivity(this, this.mFilter, null, callBackId);
FotoGalleryActivity.showActivity(this, this.mFilter, null, 0);
}
return true;
}
Expand Down Expand Up @@ -867,7 +880,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

case R.id.cmd_edit_geo: {
SelectedFiles selectedItem = getCurrentFoto();
GeoEditActivity.showActivity(this, selectedItem);
GeoEditActivity.showActivity(this, selectedItem, GeoEditActivity.RESULT_ID);
return true;
}
case R.id.cmd_edit_tags: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class GeoEditActivity extends LocalizedActivity implements Common {
private ProgressBar mProgressBar = null;
private TextView mLblStatusMessage;

public static void showActivity(Activity context, SelectedFiles selectedFiles) {
public static void showActivity(Activity context, SelectedFiles selectedFiles, int requestCode) {
Uri initalUri = null;
final Intent intent = new Intent().setClass(context,
GeoEditActivity.class);
Expand All @@ -101,7 +101,11 @@ public static void showActivity(Activity context, SelectedFiles selectedFiles) {
+ " > GeoEditActivity.showActivity@" + initalUri);
}

context.startActivityForResult(intent, RESULT_ID);
if (requestCode != 0) {
context.startActivityForResult(intent, requestCode);
} else {
context.startActivity(intent);
}
}

@Override
Expand Down Expand Up @@ -316,7 +320,7 @@ private void showLatLonPicker(String geoUri) {
}
try {
// #7: allow choosing geo pick from map or from "photo with geo"
this.startActivityForResult(Intent.createChooser(intent, this.getString(R.string.geo_edit_menu_title)), RESULT_ID);
this.startActivityForResult(Intent.createChooser(intent, this.getString(R.string.geo_edit_menu_title)), GeoEditActivity.RESULT_ID);
// this.startActivityForResult(intent, RESULT_ID);
} catch (ActivityNotFoundException ex) {
Toast.makeText(this, R.string.geo_picker_err_not_found,Toast.LENGTH_LONG).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ private boolean showPhoto(IGeoPoint geoPosition) {
TagSql.filter2QueryEx(query, filter, false);
FotoSql.setSort(query, FotoSql.SORT_BY_DATE, false);

ImageDetailActivityViewPager.showActivity(this.getActivity(), null, 0, query);
ImageDetailActivityViewPager.showActivity(this.getActivity(), null, 0, query, 0);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private boolean showPhoto(IGeoRectangle geoArea) {
FotoSql.setSort(query, FotoSql.SORT_BY_DATE, false);
FotoSql.addWhereFilterLatLon(query, geoArea);

ImageDetailActivityViewPager.showActivity(this, null, 0, query);
ImageDetailActivityViewPager.showActivity(this, null, 0, query, 0);
return true;
}

Expand Down Expand Up @@ -308,7 +308,7 @@ private void onFilterChanged(GalleryFilterParameter filter) {

private void openFilter() {
GalleryFilterActivity.showActivity(this, this.mFilter, null,
mBookmarkController.getlastBookmarkFileName());
mBookmarkController.getlastBookmarkFileName(), GalleryFilterActivity.resultID);
}

private GeoPointDto getGeoPointDtoFromIntent(Intent intent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private boolean onPopUpClick(MenuItem menuItem) {
public static boolean handleMenuShow(int menuItemItemId, Tag selectedTag, Activity context, IGalleryFilter parentFilter) {
switch (menuItemItemId) {
case R.id.cmd_photo:
ImageDetailActivityViewPager.showActivity(context, null, 0, createSubQueryByTag(parentFilter, selectedTag));
ImageDetailActivityViewPager.showActivity(context, null, 0, createSubQueryByTag(parentFilter, selectedTag), 0);
return true;
case R.id.cmd_gallery:
FotoGalleryActivity.showActivity(context, createSubFilterByTag(parentFilter, selectedTag), null, 0);
Expand Down

0 comments on commit 3a81767

Please sign in to comment.