mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
s/getSherlockActivity/getActivity/ in recent code
Where we don't specifically need action-bar or fragment-related stuff, it's cleaner to use regular getActivity(). If/when the action bar shows up in the general support libraries that'll be easier to update.
This commit is contained in:
parent
75f8370d99
commit
520eb5474c
2 changed files with 7 additions and 7 deletions
|
|
@ -274,7 +274,7 @@ public class ContributionsListFragment extends SherlockFragment {
|
||||||
contributionsList.setSelection(savedInstanceState.getInt("grid-position"));
|
contributionsList.setSelection(savedInstanceState.getInt("grid-position"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences prefs = this.getSherlockActivity().getSharedPreferences("prefs", Context.MODE_PRIVATE);
|
SharedPreferences prefs = this.getActivity().getSharedPreferences("prefs", Context.MODE_PRIVATE);
|
||||||
String lastModified = prefs.getString("lastSyncTimestamp", "");
|
String lastModified = prefs.getString("lastSyncTimestamp", "");
|
||||||
if (lastModified.equals("")) {
|
if (lastModified.equals("")) {
|
||||||
waitingMessage.setVisibility(View.VISIBLE);
|
waitingMessage.setVisibility(View.VISIBLE);
|
||||||
|
|
|
||||||
|
|
@ -139,12 +139,12 @@ public class MediaDetailPagerFragment extends SherlockFragment implements ViewPa
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_retry_current_image:
|
case R.id.menu_retry_current_image:
|
||||||
// Is this... sane? :)
|
// Is this... sane? :)
|
||||||
((ContributionsActivity)getSherlockActivity()).retryUpload(pager.getCurrentItem());
|
((ContributionsActivity)getActivity()).retryUpload(pager.getCurrentItem());
|
||||||
getSherlockActivity().getSupportFragmentManager().popBackStack();
|
getSherlockActivity().getSupportFragmentManager().popBackStack();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_abort_current_image:
|
case R.id.menu_abort_current_image:
|
||||||
// todo: delete image
|
// todo: delete image
|
||||||
((ContributionsActivity)getSherlockActivity()).deleteUpload(pager.getCurrentItem());
|
((ContributionsActivity)getActivity()).deleteUpload(pager.getCurrentItem());
|
||||||
getSherlockActivity().getSupportFragmentManager().popBackStack();
|
getSherlockActivity().getSupportFragmentManager().popBackStack();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
@ -184,7 +184,7 @@ public class MediaDetailPagerFragment extends SherlockFragment implements ViewPa
|
||||||
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
final DownloadManager manager = (DownloadManager)getSherlockActivity().getSystemService(Context.DOWNLOAD_SERVICE);
|
final DownloadManager manager = (DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE);
|
||||||
final long downloadId = manager.enqueue(req);
|
final long downloadId = manager.enqueue(req);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
|
@ -203,17 +203,17 @@ public class MediaDetailPagerFragment extends SherlockFragment implements ViewPa
|
||||||
if (status == DownloadManager.STATUS_SUCCESSFUL) {
|
if (status == DownloadManager.STATUS_SUCCESSFUL) {
|
||||||
// Force Gallery to index the new file
|
// Force Gallery to index the new file
|
||||||
Uri mediaUri = Uri.parse("file://" + Environment.getExternalStorageDirectory());
|
Uri mediaUri = Uri.parse("file://" + Environment.getExternalStorageDirectory());
|
||||||
getSherlockActivity().sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, mediaUri));
|
getActivity().sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, mediaUri));
|
||||||
|
|
||||||
// todo: show a persistent notification?
|
// todo: show a persistent notification?
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("Commons", "Couldn't get download status for some reason");
|
Log.d("Commons", "Couldn't get download status for some reason");
|
||||||
}
|
}
|
||||||
getSherlockActivity().unregisterReceiver(this);
|
getActivity().unregisterReceiver(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getSherlockActivity().registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
getActivity().registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue