fix #45, display proper filename when opening an item from Downloads folder
This commit is contained in:
parent
a5da407ed3
commit
a31533418d
|
@ -2,8 +2,10 @@ package com.simplemobiletools.gallery.activities;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.MediaStore;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -52,8 +54,22 @@ public class PhotoVideoActivity extends SimpleActivity implements ViewPagerFragm
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_holder, mFragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_holder, mFragment).commit();
|
||||||
}
|
}
|
||||||
hideSystemUI();
|
hideSystemUI();
|
||||||
|
|
||||||
|
if (mUri.getScheme().equals("content")) {
|
||||||
|
String[] proj = { MediaStore.Images.Media.TITLE };
|
||||||
|
Cursor cursor = getContentResolver().query(mUri, proj, null, null, null);
|
||||||
|
if (cursor != null && cursor.getCount() != 0) {
|
||||||
|
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE);
|
||||||
|
cursor.moveToFirst();
|
||||||
|
setTitle(cursor.getString(columnIndex));
|
||||||
|
}
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
setTitle(Utils.Companion.getFilename(mUri.toString()));
|
setTitle(Utils.Companion.getFilename(mUri.toString()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
|
Loading…
Reference in New Issue