Skip to content

Commit

Permalink
Merge pull request #401 from nikhilchowdary/bug-fixes
Browse files Browse the repository at this point in the history
Fixes #400 Long toast queue
  • Loading branch information
opticod authored Feb 10, 2017
2 parents fcb0255 + 4da78ec commit b932e1b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class SettingsFragment extends PreferenceFragment {

private static final int REQUEST_PICK_APK = 9985;
private Preference prefUsername;
private Toast mToast;

private static float deleteDirectory(File file, float size) {
if (file.exists()) {
Expand All @@ -61,6 +62,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.fragment_settings);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
mToast=Toast.makeText(getActivity()," ",Toast.LENGTH_SHORT);

Preference deleteTempFiles = findPreference(getString(R.string.key_delete_temporary_files));
deleteTempFiles.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
Expand All @@ -81,8 +83,10 @@ public boolean onPreferenceClick(Preference preference) {
if(NetworkUtils.isNetworkAvailable(getActivity()))
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id=" + getActivity().getPackageName())));
else
Toast.makeText(getActivity(), R.string.settings_network_unavailable,Toast.LENGTH_SHORT).show();
else {
mToast.setText(R.string.settings_network_unavailable);
mToast.show();
}
return true;
}
});
Expand Down Expand Up @@ -342,7 +346,8 @@ protected void onPostExecute(Float size) {
if (size != 0) {
Toast.makeText(getActivity(), "Deleted " + size + " MB.", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "No Temp Files Found!", Toast.LENGTH_SHORT).show();
mToast.setText("No Temp Files Found!");
mToast.show();
}
}
}
Expand Down

0 comments on commit b932e1b

Please sign in to comment.