Correctly size dialogs across the app
This commit is contained in:
parent
6387d98d5d
commit
2f57685610
@ -5,6 +5,7 @@
|
|||||||
package acr.browser.lightning.activity;
|
package acr.browser.lightning.activity;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -982,12 +983,14 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
@Override
|
@Override
|
||||||
public void showBlockedLocalFileDialog(DialogInterface.OnClickListener listener) {
|
public void showBlockedLocalFileDialog(DialogInterface.OnClickListener listener) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setCancelable(true)
|
Dialog dialog = builder.setCancelable(true)
|
||||||
.setTitle(R.string.title_warning)
|
.setTitle(R.string.title_warning)
|
||||||
.setMessage(R.string.message_blocked_local)
|
.setMessage(R.string.message_blocked_local)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.action_open, listener)
|
.setPositiveButton(R.string.action_open, listener)
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
|
BrowserDialog.setDialogSize(this, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package acr.browser.lightning.activity;
|
package acr.browser.lightning.activity;
|
||||||
|
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
@ -27,6 +28,7 @@ import javax.inject.Inject;
|
|||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
import com.anthonycr.bonsai.Action;
|
import com.anthonycr.bonsai.Action;
|
||||||
import com.anthonycr.bonsai.Observable;
|
import com.anthonycr.bonsai.Observable;
|
||||||
@ -159,6 +161,7 @@ public class ReadingActivity extends AppCompatActivity {
|
|||||||
mProgressDialog.setIndeterminate(true);
|
mProgressDialog.setIndeterminate(true);
|
||||||
mProgressDialog.setMessage(getString(R.string.loading));
|
mProgressDialog.setMessage(getString(R.string.loading));
|
||||||
mProgressDialog.show();
|
mProgressDialog.show();
|
||||||
|
BrowserDialog.setDialogSize(ReadingActivity.this, mProgressDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -321,7 +324,8 @@ public class ReadingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(this, dialog);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
finish();
|
finish();
|
||||||
|
@ -2,6 +2,7 @@ package acr.browser.lightning.activity;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -27,6 +28,7 @@ import acr.browser.lightning.constant.HistoryPage;
|
|||||||
import acr.browser.lightning.constant.StartPage;
|
import acr.browser.lightning.constant.StartPage;
|
||||||
import acr.browser.lightning.database.BookmarkManager;
|
import acr.browser.lightning.database.BookmarkManager;
|
||||||
import acr.browser.lightning.database.HistoryDatabase;
|
import acr.browser.lightning.database.HistoryDatabase;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.anthonycr.bonsai.Action;
|
import com.anthonycr.bonsai.Action;
|
||||||
@ -169,7 +171,7 @@ public class TabsManager {
|
|||||||
if (url != null) {
|
if (url != null) {
|
||||||
if (url.startsWith(Constants.FILE)) {
|
if (url.startsWith(Constants.FILE)) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setCancelable(true)
|
Dialog dialog = builder.setCancelable(true)
|
||||||
.setTitle(R.string.title_warning)
|
.setTitle(R.string.title_warning)
|
||||||
.setMessage(R.string.message_blocked_local)
|
.setMessage(R.string.message_blocked_local)
|
||||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
@ -189,6 +191,7 @@ public class TabsManager {
|
|||||||
newTab(activity, url, false);
|
newTab(activity, url, false);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
|
BrowserDialog.setDialogSize(activity, dialog);
|
||||||
} else {
|
} else {
|
||||||
newTab(activity, url, false);
|
newTab(activity, url, false);
|
||||||
if (mTabList.isEmpty()) {
|
if (mTabList.isEmpty()) {
|
||||||
|
@ -2,6 +2,7 @@ package acr.browser.lightning.dialog;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@ -122,15 +123,9 @@ public class BrowserDialog {
|
|||||||
listView.setDivider(null);
|
listView.setDivider(null);
|
||||||
builder.setView(layout);
|
builder.setView(layout);
|
||||||
|
|
||||||
int maxWidth = ResourceUtils.dimen(activity, R.dimen.dialog_max_size);
|
|
||||||
int padding = ResourceUtils.dimen(activity, R.dimen.dialog_padding);
|
|
||||||
int screenSize = DeviceUtils.getScreenWidth(activity);
|
|
||||||
if (maxWidth > screenSize - 2 * padding) {
|
|
||||||
maxWidth = screenSize - 2 * padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Dialog dialog = builder.show();
|
final Dialog dialog = builder.show();
|
||||||
dialog.getWindow().setLayout(maxWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
|
setDialogSize(activity, dialog);
|
||||||
|
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -172,7 +167,19 @@ public class BrowserDialog {
|
|||||||
listener.onClick(editText.getText().toString());
|
listener.onClick(editText.getText().toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
editorDialog.show();
|
|
||||||
|
Dialog dialog = editorDialog.show();
|
||||||
|
setDialogSize(activity, dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDialogSize(@NonNull Context context, @NonNull Dialog dialog) {
|
||||||
|
int maxWidth = ResourceUtils.dimen(context, R.dimen.dialog_max_size);
|
||||||
|
int padding = ResourceUtils.dimen(context, R.dimen.dialog_padding);
|
||||||
|
int screenSize = DeviceUtils.getScreenWidth(context);
|
||||||
|
if (maxWidth > screenSize - 2 * padding) {
|
||||||
|
maxWidth = screenSize - 2 * padding;
|
||||||
|
}
|
||||||
|
dialog.getWindow().setLayout(maxWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package acr.browser.lightning.dialog;
|
package acr.browser.lightning.dialog;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -156,7 +157,8 @@ public class LightningDialogBuilder {
|
|||||||
mEventBus.post(new BookmarkEvents.BookmarkChanged(item, editedItem));
|
mEventBus.post(new BookmarkEvents.BookmarkChanged(item, editedItem));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
editBookmarkDialog.show();
|
Dialog dialog = editBookmarkDialog.show();
|
||||||
|
BrowserDialog.setDialogSize(activity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showBookmarkFolderLongPressedDialog(@NonNull final Activity activity, @NonNull final HistoryItem item) {
|
public void showBookmarkFolderLongPressedDialog(@NonNull final Activity activity, @NonNull final HistoryItem item) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
package acr.browser.lightning.download;
|
package acr.browser.lightning.download;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.app.DownloadManager;
|
import android.app.DownloadManager;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -31,6 +32,7 @@ import acr.browser.lightning.activity.MainActivity;
|
|||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.bus.BrowserEvents;
|
import acr.browser.lightning.bus.BrowserEvents;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,9 +159,10 @@ public class DownloadHandler {
|
|||||||
title = R.string.download_no_sdcard_dlg_title;
|
title = R.string.download_no_sdcard_dlg_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
new AlertDialog.Builder(context).setTitle(title)
|
Dialog dialog = new AlertDialog.Builder(context).setTitle(title)
|
||||||
.setIcon(android.R.drawable.ic_dialog_alert).setMessage(msg)
|
.setIcon(android.R.drawable.ic_dialog_alert).setMessage(msg)
|
||||||
.setPositiveButton(R.string.action_ok, null).show();
|
.setPositiveButton(R.string.action_ok, null).show();
|
||||||
|
BrowserDialog.setDialogSize(context, dialog);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ package acr.browser.lightning.download;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -14,6 +15,7 @@ import android.webkit.URLUtil;
|
|||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.anthonycr.grant.PermissionsManager;
|
import com.anthonycr.grant.PermissionsManager;
|
||||||
@ -56,12 +58,13 @@ public class LightningDownloadListener implements DownloadListener {
|
|||||||
};
|
};
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
|
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
|
||||||
builder.setTitle(fileName)
|
Dialog dialog = builder.setTitle(fileName)
|
||||||
.setMessage(mActivity.getResources().getString(R.string.dialog_download))
|
.setMessage(mActivity.getResources().getString(R.string.dialog_download))
|
||||||
.setPositiveButton(mActivity.getResources().getString(R.string.action_download),
|
.setPositiveButton(mActivity.getResources().getString(R.string.action_download),
|
||||||
dialogClickListener)
|
dialogClickListener)
|
||||||
.setNegativeButton(mActivity.getResources().getString(R.string.action_cancel),
|
.setNegativeButton(mActivity.getResources().getString(R.string.action_cancel),
|
||||||
dialogClickListener).show();
|
dialogClickListener).show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
Log.i(Constants.TAG, "Downloading" + fileName);
|
Log.i(Constants.TAG, "Downloading" + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package acr.browser.lightning.fragment;
|
package acr.browser.lightning.fragment;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
@ -16,6 +17,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
|
|
||||||
public class AdvancedSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
public class AdvancedSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||||
|
|
||||||
@ -167,8 +169,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textEncodingPicker() {
|
private void textEncodingPicker() {
|
||||||
@ -184,8 +187,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
|
|||||||
textEncoding.setSummary(Constants.TEXT_ENCODINGS[which]);
|
textEncoding.setSummary(Constants.TEXT_ENCODINGS[which]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void urlBoxPicker() {
|
private void urlBoxPicker() {
|
||||||
@ -203,7 +207,8 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ package acr.browser.lightning.fragment;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@ -41,6 +42,8 @@ import acr.browser.lightning.database.BookmarkManager;
|
|||||||
import acr.browser.lightning.database.HistoryItem;
|
import acr.browser.lightning.database.HistoryItem;
|
||||||
import com.anthonycr.bonsai.OnSubscribe;
|
import com.anthonycr.bonsai.OnSubscribe;
|
||||||
import com.anthonycr.bonsai.Schedulers;
|
import com.anthonycr.bonsai.Schedulers;
|
||||||
|
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.utils.Preconditions;
|
import acr.browser.lightning.utils.Preconditions;
|
||||||
import acr.browser.lightning.utils.Utils;
|
import acr.browser.lightning.utils.Utils;
|
||||||
|
|
||||||
@ -245,7 +248,8 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
|||||||
mBookmarkManager.deleteAllBookmarks();
|
mBookmarkManager.deleteAllBookmarks();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@ -310,7 +314,8 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -379,12 +384,17 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createDialog() {
|
private void createDialog() {
|
||||||
|
if(mActivity == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||||
|
|
||||||
final String title = getString(R.string.title_chooser);
|
final String title = getString(R.string.title_chooser);
|
||||||
builder.setTitle(title + ": " + Environment.getExternalStorageDirectory());
|
builder.setTitle(title + ": " + Environment.getExternalStorageDirectory());
|
||||||
if (mFileList == null) {
|
if (mFileList == null) {
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
builder.setItems(mFileNameList, new DialogInterface.OnClickListener() {
|
builder.setItems(mFileNameList, new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@ -394,13 +404,15 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
|||||||
builder.setTitle(title + ": " + mFileList[which]);
|
builder.setTitle(title + ": " + mFileList[which]);
|
||||||
loadFileList(mFileList[which]);
|
loadFileList(mFileList[which]);
|
||||||
builder.setItems(mFileNameList, this);
|
builder.setItems(mFileNameList, this);
|
||||||
builder.show();
|
Dialog dialog1 = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog1);
|
||||||
} else {
|
} else {
|
||||||
mBookmarkManager.importBookmarksFromFile(mFileList[which], getActivity());
|
mBookmarkManager.importBookmarksFromFile(mFileList[which], getActivity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package acr.browser.lightning.fragment;
|
package acr.browser.lightning.fragment;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
@ -19,6 +20,7 @@ import android.widget.SeekBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
|
|
||||||
public class DisplaySettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
public class DisplaySettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||||
|
|
||||||
@ -150,7 +152,8 @@ public class DisplaySettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getTextSize(int size) {
|
private static float getTextSize(int size) {
|
||||||
@ -187,7 +190,7 @@ public class DisplaySettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
picker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -205,7 +208,8 @@ public class DisplaySettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TextSeekBarListener implements SeekBar.OnSeekBarChangeListener {
|
private static class TextSeekBarListener implements SeekBar.OnSeekBarChangeListener {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package acr.browser.lightning.fragment;
|
package acr.browser.lightning.fragment;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -23,6 +24,7 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.download.DownloadHandler;
|
import acr.browser.lightning.download.DownloadHandler;
|
||||||
import acr.browser.lightning.utils.ProxyUtils;
|
import acr.browser.lightning.utils.ProxyUtils;
|
||||||
import acr.browser.lightning.utils.ThemeUtils;
|
import acr.browser.lightning.utils.ThemeUtils;
|
||||||
@ -167,7 +169,8 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
+ text);
|
+ text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
urlPicker.show();
|
Dialog dialog = urlPicker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getFlashChoice() {
|
private void getFlashChoice() {
|
||||||
@ -199,6 +202,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void proxyChoicePicker() {
|
private void proxyChoicePicker() {
|
||||||
@ -212,8 +216,9 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
setProxyChoice(which);
|
setProxyChoice(which);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setProxyChoice(int choice) {
|
private void setProxyChoice(int choice) {
|
||||||
@ -250,7 +255,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
eProxyHost.setText(mPreferenceManager.getProxyHost());
|
eProxyHost.setText(mPreferenceManager.getProxyHost());
|
||||||
eProxyPort.setText(Integer.toString(mPreferenceManager.getProxyPort()));
|
eProxyPort.setText(Integer.toString(mPreferenceManager.getProxyPort()));
|
||||||
|
|
||||||
new AlertDialog.Builder(mActivity)
|
Dialog dialog = new AlertDialog.Builder(mActivity)
|
||||||
.setTitle(R.string.manual_proxy)
|
.setTitle(R.string.manual_proxy)
|
||||||
.setView(v)
|
.setView(v)
|
||||||
.setPositiveButton(R.string.action_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.action_ok, new DialogInterface.OnClickListener() {
|
||||||
@ -270,6 +275,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
proxy.setSummary(proxyHost + ':' + proxyPort);
|
proxy.setSummary(proxyHost + ':' + proxyPort);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void searchDialog() {
|
private void searchDialog() {
|
||||||
@ -290,8 +296,9 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
setSearchEngineSummary(which);
|
setSearchEngineSummary(which);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void homepageDialog() {
|
private void homepageDialog() {
|
||||||
@ -332,8 +339,9 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void homePicker() {
|
private void homePicker() {
|
||||||
@ -357,7 +365,8 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
home.setSummary(text);
|
home.setSummary(text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
homePicker.show();
|
Dialog dialog = homePicker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadLocDialog() {
|
private void downloadLocDialog() {
|
||||||
@ -386,8 +395,9 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
picker.show();
|
Dialog dialog = picker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void agentDialog() {
|
private void agentDialog() {
|
||||||
@ -416,8 +426,9 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
agentPicker.setNeutralButton(getResources().getString(R.string.action_ok), null);
|
agentPicker.setPositiveButton(getResources().getString(R.string.action_ok), null);
|
||||||
agentPicker.show();
|
Dialog dialog = agentPicker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void agentPicker() {
|
private void agentPicker() {
|
||||||
@ -434,7 +445,8 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
useragent.setSummary(getResources().getString(R.string.agent_custom));
|
useragent.setSummary(getResources().getString(R.string.agent_custom));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
agentStringPicker.show();
|
Dialog dialog = agentStringPicker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downPicker() {
|
private void downPicker() {
|
||||||
@ -463,7 +475,8 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
downloadloc.setSummary(text);
|
downloadloc.setSummary(text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
downLocationPicker.show();
|
Dialog dialog = downLocationPicker.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSearchEngineSummary(int which) {
|
private void setSearchEngineSummary(int which) {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package acr.browser.lightning.fragment;
|
package acr.browser.lightning.fragment;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -20,6 +21,7 @@ import javax.inject.Inject;
|
|||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.database.HistoryDatabase;
|
import acr.browser.lightning.database.HistoryDatabase;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.utils.Utils;
|
import acr.browser.lightning.utils.Utils;
|
||||||
import acr.browser.lightning.utils.WebUtils;
|
import acr.browser.lightning.utils.WebUtils;
|
||||||
import acr.browser.lightning.view.LightningView;
|
import acr.browser.lightning.view.LightningView;
|
||||||
@ -154,7 +156,7 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
private void clearHistoryDialog() {
|
private void clearHistoryDialog() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||||
builder.setTitle(getResources().getString(R.string.title_clear_history));
|
builder.setTitle(getResources().getString(R.string.title_clear_history));
|
||||||
builder.setMessage(getResources().getString(R.string.dialog_history))
|
Dialog dialog = builder.setMessage(getResources().getString(R.string.dialog_history))
|
||||||
.setPositiveButton(getResources().getString(R.string.action_yes),
|
.setPositiveButton(getResources().getString(R.string.action_yes),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -168,6 +170,7 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(getResources().getString(R.string.action_no), null).show();
|
.setNegativeButton(getResources().getString(R.string.action_no), null).show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearCookiesDialog() {
|
private void clearCookiesDialog() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package acr.browser.lightning.utils;
|
package acr.browser.lightning.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
@ -17,6 +18,7 @@ import acr.browser.lightning.R;
|
|||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.bus.BrowserEvents;
|
import acr.browser.lightning.bus.BrowserEvents;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
import info.guardianproject.netcipher.proxy.OrbotHelper;
|
import info.guardianproject.netcipher.proxy.OrbotHelper;
|
||||||
import info.guardianproject.netcipher.web.WebkitProxy;
|
import info.guardianproject.netcipher.web.WebkitProxy;
|
||||||
@ -67,7 +69,7 @@ public class ProxyUtils {
|
|||||||
mPreferences.setProxyChoice(which);
|
mPreferences.setProxyChoice(which);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(activity.getResources().getString(R.string.action_ok),
|
.setPositiveButton(activity.getResources().getString(R.string.action_ok),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
@ -96,7 +98,8 @@ public class ProxyUtils {
|
|||||||
.setPositiveButton(R.string.yes, dialogClickListener)
|
.setPositiveButton(R.string.yes, dialogClickListener)
|
||||||
.setNegativeButton(R.string.no, dialogClickListener);
|
.setNegativeButton(R.string.no, dialogClickListener);
|
||||||
}
|
}
|
||||||
builder.show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(activity, dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ import acr.browser.lightning.R;
|
|||||||
import acr.browser.lightning.activity.MainActivity;
|
import acr.browser.lightning.activity.MainActivity;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
import acr.browser.lightning.database.HistoryItem;
|
import acr.browser.lightning.database.HistoryItem;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.download.DownloadHandler;
|
import acr.browser.lightning.download.DownloadHandler;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
|
|
||||||
@ -132,6 +133,7 @@ public final class Utils {
|
|||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
BrowserDialog.setDialogSize(activity, alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +25,7 @@ import com.anthonycr.grant.PermissionsResultAction;
|
|||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.controller.UIController;
|
import acr.browser.lightning.controller.UIController;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.utils.Preconditions;
|
import acr.browser.lightning.utils.Preconditions;
|
||||||
|
|
||||||
class LightningChromeClient extends WebChromeClient {
|
class LightningChromeClient extends WebChromeClient {
|
||||||
@ -120,6 +121,7 @@ class LightningChromeClient extends WebChromeClient {
|
|||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,6 +2,7 @@ package acr.browser.lightning.view;
|
|||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -38,6 +39,7 @@ import acr.browser.lightning.R;
|
|||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.constant.Constants;
|
import acr.browser.lightning.constant.Constants;
|
||||||
import acr.browser.lightning.controller.UIController;
|
import acr.browser.lightning.controller.UIController;
|
||||||
|
import acr.browser.lightning.dialog.BrowserDialog;
|
||||||
import acr.browser.lightning.utils.AdBlock;
|
import acr.browser.lightning.utils.AdBlock;
|
||||||
import acr.browser.lightning.utils.IntentUtils;
|
import acr.browser.lightning.utils.IntentUtils;
|
||||||
import acr.browser.lightning.utils.Preconditions;
|
import acr.browser.lightning.utils.Preconditions;
|
||||||
@ -160,7 +162,7 @@ public class LightningWebClient extends WebViewClient {
|
|||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
private volatile boolean mIsRunning = false;
|
private volatile boolean mIsRunning = false;
|
||||||
@ -247,7 +249,8 @@ public class LightningWebClient extends WebViewClient {
|
|||||||
handler.cancel();
|
handler.cancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
Dialog dialog = builder.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -272,6 +275,7 @@ public class LightningWebClient extends WebViewClient {
|
|||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
BrowserDialog.setDialogSize(mActivity, alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user