Browse Source

bug修复

dxh 5 years ago
parent
commit
13ffd37a15

+ 29 - 1
app/src/main/java/com/electric/chargingpile/activity/PublishTopicActivity.java

2

2

3
import android.app.Activity;
3
import android.app.Activity;
4
import android.content.Context;
4
import android.content.Context;
5
import android.content.DialogInterface;
5
import android.content.Intent;
6
import android.content.Intent;
6
import android.graphics.drawable.Drawable;
7
import android.graphics.drawable.Drawable;
7
import android.net.Uri;
8
import android.net.Uri;
8
import android.os.Bundle;
9
import android.os.Bundle;
9
import android.os.Environment;
10
import android.os.Environment;
10
import android.support.annotation.Nullable;
11
import android.support.annotation.Nullable;
12
import android.support.v7.app.AlertDialog;
11
import android.text.Editable;
13
import android.text.Editable;
12
import android.text.Html;
14
import android.text.Html;
13
import android.text.TextUtils;
15
import android.text.TextUtils;
14
import android.text.TextWatcher;
16
import android.text.TextWatcher;
15
import android.util.Log;
17
import android.util.Log;
18
import android.view.KeyEvent;
16
import android.view.View;
19
import android.view.View;
17
import android.view.View.OnClickListener;
20
import android.view.View.OnClickListener;
18
import android.widget.EditText;
21
import android.widget.EditText;
139
    public void onClick(View v) {
142
    public void onClick(View v) {
140
        switch (v.getId()) {
143
        switch (v.getId()) {
141
            case R.id.publishtopic_back:
144
            case R.id.publishtopic_back:
142
                finish();
145
                showDialogToExit();
146
//                finish();
143
                break;
147
                break;
144
            case R.id.publishtopic_publish:
148
            case R.id.publishtopic_publish:
145
                if (media == null) {
149
                if (media == null) {
381
        super.onPause();
385
        super.onPause();
382
        MobclickAgent.onPause(this);
386
        MobclickAgent.onPause(this);
383
    }
387
    }
388

389
    private void showDialogToExit(){
390
        AlertDialog.Builder builder = new AlertDialog.Builder(PublishTopicActivity.this);
391
        builder.setTitle("提示");
392
        builder.setMessage("确认取消发布?");
393
        builder.setCancelable(false);
394
        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
395
            @Override
396
            public void onClick(DialogInterface dialog, int which) {
397
                finish();
398
            }
399
        });
400
        builder.setNegativeButton("取消", null);
401
        builder.create().show();
402
    }
403

404
    @Override
405
    public boolean onKeyUp(int keyCode, KeyEvent event) {
406
        if (keyCode == KeyEvent.KEYCODE_BACK) {
407
            showDialogToExit();
408
            return true;
409
        }
410
        return false;
411
    }
384
}
412
}