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.DownloadListener;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
import fr.gouv.etalab.mastodon.webview.MastalabWebChromeClient;
|
import fr.gouv.etalab.mastodon.webview.MastalabWebChromeClient;
|
||||||
|
@ -144,7 +145,11 @@ public class WebviewActivity extends BaseActivity {
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_go:
|
case R.id.action_go:
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
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;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ListView;
|
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
|
@Override
|
||||||
public void onRetrieveWhoToFollowList(List<String> list) {
|
public void onRetrieveWhoToFollowList(List<String> list) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue