Android: Invalidate Picasso screenshot cache every time a screenshot is displayed.

This commit is contained in:
sigmabeta 2015-06-18 21:46:47 -04:00 committed by Eder Bastos
parent a028805626
commit 8ca620db7f
3 changed files with 8 additions and 11 deletions

View File

@ -127,13 +127,6 @@ public final class MainActivity extends AppCompatActivity implements LoaderManag
}
}
@Override
protected void onResume()
{
super.onResume();
mAdapter.notifyDataSetChanged();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{

View File

@ -79,9 +79,13 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
{
if (mCursor.moveToPosition(position))
{
String screenPath = mCursor.getString(GameDatabase.GAME_COLUMN_SCREENSHOT_PATH);
Picasso.with(holder.imageScreenshot.getContext())
.invalidate(screenPath);
// Fill in the view contents.
Picasso.with(holder.imageScreenshot.getContext())
.load(mCursor.getString(GameDatabase.GAME_COLUMN_SCREENSHOT_PATH))
.load(screenPath)
.fit()
.centerCrop()
.error(R.drawable.no_banner)

View File

@ -678,10 +678,10 @@ void SaveScreenShot(std::string name)
SetState(CORE_PAUSE);
const std::string& gameId = SConfig::GetInstance().GetUniqueID();
std::string path = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
name = StringFromFormat("%s%s.png", path.c_str(), name.c_str());
g_video_backend->Video_Screenshot(name);
std::string filePath = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR + name + ".png";
g_video_backend->Video_Screenshot(filePath);
if (!bPaused)
SetState(CORE_RUN);