Skip to content

Commit

Permalink
Preference to disable swipe-down-to-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumBadger committed Sep 8, 2016
1 parent e17dab7 commit 7392c6e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions assets/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Preference to hide floating toolbar over images
Preference to make link text non-clickable
Preference to disable swipe-down-to-refresh
For albums with only one image, the image is now shown immediately
When sending PMs, input fields are cleared if send succeeded
Fixed bug with huge "load more comments" links
Support for imgflip links

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class PMSendActivity extends BaseActivity {
private EditText subjectEdit;
private EditText textEdit;

private boolean mSendSuccess;

private static String lastText, lastRecipient, lastSubject;

@Override
Expand Down Expand Up @@ -87,20 +89,23 @@ protected void onCreate(Bundle savedInstanceState) {
initialSubject = savedInstanceState.getString(SAVED_STATE_SUBJECT);
initialText = savedInstanceState.getString(SAVED_STATE_TEXT);

} else if(getIntent() != null && getIntent().hasExtra(EXTRA_RECIPIENT)) {
initialRecipient = getIntent().getStringExtra(EXTRA_RECIPIENT);
initialSubject = getIntent().getStringExtra(EXTRA_SUBJECT);
initialText = lastText;
} else {

} else if(lastText != null) {
initialRecipient = lastRecipient;
initialSubject = lastSubject;
initialText = lastText;
final Intent intent = getIntent();

} else {
initialRecipient = null;
initialSubject = null;
initialText = null;
if(intent != null && intent.hasExtra(EXTRA_RECIPIENT)) {
initialRecipient = intent.getStringExtra(EXTRA_RECIPIENT);
} else {
initialRecipient = lastRecipient;
}

if(intent != null && intent.hasExtra(EXTRA_SUBJECT)) {
initialSubject = intent.getStringExtra(EXTRA_SUBJECT);
} else {
initialSubject = lastSubject;
}

initialText = lastText;
}

if(initialRecipient != null) {
Expand Down Expand Up @@ -195,7 +200,15 @@ protected void onSuccess() {
AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
@Override
public void run() {

if(progressDialog.isShowing()) progressDialog.dismiss();

mSendSuccess = true;

lastText = null;
lastRecipient = null;
lastSubject = null;

General.quickToast(PMSendActivity.this, getString(R.string.pm_send_done));
finish();
}
Expand Down Expand Up @@ -289,7 +302,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
protected void onDestroy() {
super.onDestroy();

if(textEdit != null) {
if(!mSendSuccess && textEdit != null) {
lastRecipient = recipientEdit.getText().toString();
lastSubject = subjectEdit.getText().toString();
lastText = textEdit.getText().toString();
Expand Down

0 comments on commit 7392c6e

Please sign in to comment.