Fix potential crashes
This commit is contained in:
parent
e2bfbc0ab2
commit
97ddb9698a
|
@ -32,6 +32,7 @@ import android.view.WindowManager;
|
|||
import android.webkit.DownloadListener;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.webview.MastalabWebChromeClient;
|
||||
|
@ -144,7 +145,11 @@ public class WebviewActivity extends BaseActivity {
|
|||
return true;
|
||||
case R.id.action_go:
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(browserIntent);
|
||||
try {
|
||||
startActivity(browserIntent);
|
||||
}catch (Exception e){
|
||||
Toast.makeText(WebviewActivity.this, R.string.toast_error, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
|
@ -196,6 +197,18 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveWhoToFollowList(List<String> list) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue