mirror of https://github.com/LeOS-GSI/LeOS-Genesis
parent
7635345265
commit
242057bd51
|
@ -141,6 +141,6 @@ dependencies {
|
|||
implementation 'com.android.support:design:28.0.0'
|
||||
implementation 'com.android.volley:volley:1.2.0'
|
||||
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.3'
|
||||
implementation files('libs\\httpclientandroidlib-1.2.1.jar')
|
||||
|
||||
implementation files('libs/httpclientandroidlib-1.2.1.jar')
|
||||
implementation 'net.zetetic:android-database-sqlcipher:4.4.3@aar'
|
||||
}
|
||||
|
|
|
@ -32,9 +32,14 @@ import android.widget.ScrollView;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.darkweb.genesissearchengine.helperManager.PathUtil;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -42,33 +47,34 @@ import java.util.ArrayList;
|
|||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mozilla.geckoview.AllowOrDeny;
|
||||
import org.mozilla.geckoview.GeckoResult;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoSession.PermissionDelegate.MediaSource;
|
||||
import org.mozilla.geckoview.SlowScriptResponse;
|
||||
|
||||
final class geckoPromptView implements GeckoSession.PromptDelegate {
|
||||
protected static final String LOGTAG = "geckoPromptView";
|
||||
protected static final String LOGTAG = "BasicGeckoViewPrompt";
|
||||
|
||||
private final WeakReference<Activity> mActivity;
|
||||
private final AppCompatActivity mActivity;
|
||||
public int filePickerRequestCode = 1;
|
||||
private int mFileType;
|
||||
private GeckoResult<PromptResponse> mFileResponse;
|
||||
private FilePrompt mFilePrompt;
|
||||
|
||||
public geckoPromptView(final Activity activity) {
|
||||
mActivity = new WeakReference(activity);
|
||||
public geckoPromptView(final AppCompatActivity activity) {
|
||||
mActivity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeckoResult<PromptResponse> onAlertPrompt(final GeckoSession session,
|
||||
final AlertPrompt prompt) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext())
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
||||
.setTitle(prompt.title)
|
||||
.setMessage(prompt.message)
|
||||
.setPositiveButton(android.R.string.ok, /* onClickListener */ null);
|
||||
|
@ -80,11 +86,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
@Override
|
||||
public GeckoResult<PromptResponse> onButtonPrompt(final GeckoSession session,
|
||||
final ButtonPrompt prompt) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext())
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
||||
.setTitle(prompt.title)
|
||||
.setMessage(prompt.message);
|
||||
|
||||
|
@ -111,6 +117,74 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeckoResult<PromptResponse> onSharePrompt(final GeckoSession session,
|
||||
final SharePrompt prompt) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public GeckoResult<PromptResponse> onRepostConfirmPrompt(final GeckoSession session,
|
||||
final RepostConfirmPrompt prompt) {
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
||||
.setTitle("Are you sure?")
|
||||
.setMessage("To display this page, GeckoViewExample must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.");
|
||||
|
||||
GeckoResult<PromptResponse> res = new GeckoResult<>();
|
||||
|
||||
final DialogInterface.OnClickListener listener = (dialog, which) -> {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
res.complete(prompt.confirm(AllowOrDeny.ALLOW));
|
||||
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
res.complete(prompt.confirm(AllowOrDeny.DENY));
|
||||
} else {
|
||||
res.complete(prompt.dismiss());
|
||||
}
|
||||
};
|
||||
|
||||
builder.setPositiveButton("Resend", listener);
|
||||
builder.setNegativeButton("Cancel", listener);
|
||||
|
||||
createStandardDialog(builder, prompt, res).show();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public GeckoResult<PromptResponse> onBeforeUnloadPrompt(final GeckoSession session,
|
||||
final BeforeUnloadPrompt prompt) {
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
||||
.setTitle("Are you sure?")
|
||||
.setMessage("This page is asking you to confirm that you want to leave - data you have entered may not be saved");
|
||||
|
||||
GeckoResult<PromptResponse> res = new GeckoResult<>();
|
||||
|
||||
final DialogInterface.OnClickListener listener = (dialog, which) -> {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
res.complete(prompt.confirm(AllowOrDeny.ALLOW));
|
||||
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
res.complete(prompt.confirm(AllowOrDeny.DENY));
|
||||
} else {
|
||||
res.complete(prompt.dismiss());
|
||||
}
|
||||
};
|
||||
|
||||
builder.setPositiveButton("Leave Page", listener);
|
||||
builder.setNegativeButton("Stay on Page", listener);
|
||||
|
||||
createStandardDialog(builder, prompt, res).show();
|
||||
return res;
|
||||
}
|
||||
|
||||
private int getViewPadding(final AlertDialog.Builder builder) {
|
||||
final TypedArray attr = builder.getContext().obtainStyledAttributes(
|
||||
new int[] { android.R.attr.listPreferredItemPaddingLeft });
|
||||
|
@ -153,11 +227,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
@Override
|
||||
public GeckoResult<PromptResponse> onTextPrompt(final GeckoSession session,
|
||||
final TextPrompt prompt) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message);
|
||||
final EditText editText = new EditText(builder.getContext());
|
||||
editText.setText(prompt.defaultValue);
|
||||
|
@ -181,11 +255,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
@Override
|
||||
public GeckoResult<PromptResponse> onAuthPrompt(final GeckoSession session,
|
||||
final AuthPrompt prompt) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message);
|
||||
|
||||
final int flags = prompt.authOptions.flags;
|
||||
|
@ -193,7 +267,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
final EditText username;
|
||||
if ((flags & AuthPrompt.AuthOptions.Flags.ONLY_PASSWORD) == 0) {
|
||||
username = new EditText(builder.getContext());
|
||||
username.setHint("");
|
||||
username.setHint("Username");
|
||||
username.setText(prompt.authOptions.username);
|
||||
container.addView(username);
|
||||
} else {
|
||||
|
@ -201,7 +275,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
}
|
||||
|
||||
final EditText password = new EditText(builder.getContext());
|
||||
password.setHint("");
|
||||
password.setHint("Password");
|
||||
password.setText(prompt.authOptions.password);
|
||||
password.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
|
@ -281,12 +355,12 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
final String message, final int type,
|
||||
final ChoicePrompt.Choice[] choices, final ChoicePrompt prompt,
|
||||
final GeckoResult<PromptResponse> res) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
res.complete(prompt.dismiss());
|
||||
return;
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
addStandardLayout(builder, title, message);
|
||||
|
||||
final ListView list = new ListView(builder.getContext());
|
||||
|
@ -472,11 +546,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
@Override
|
||||
public GeckoResult<PromptResponse> onColorPrompt(final GeckoSession session,
|
||||
final ColorPrompt prompt) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
addStandardLayout(builder, prompt.title, /* msg */ null);
|
||||
|
||||
final int initial = parseColor(prompt.defaultValue, /* def */ 0);
|
||||
|
@ -583,7 +657,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
@Override
|
||||
public GeckoResult<PromptResponse> onDateTimePrompt(final GeckoSession session,
|
||||
final DateTimePrompt prompt) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
|
@ -609,7 +683,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
final Calendar cal = formatter.getCalendar();
|
||||
cal.setTime(date);
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
final LayoutInflater inflater = LayoutInflater.from(builder.getContext());
|
||||
final DatePicker datePicker;
|
||||
if (prompt.type == DateTimePrompt.Type.DATE || prompt.type == DateTimePrompt.Type.MONTH ||
|
||||
|
@ -691,7 +765,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
}
|
||||
};
|
||||
builder.setNegativeButton(android.R.string.cancel, /* listener */ null)
|
||||
.setNeutralButton("Dismiss", listener)
|
||||
.setNeutralButton("Clear", listener)
|
||||
.setPositiveButton(android.R.string.ok, listener);
|
||||
createStandardDialog(builder, prompt, res).show();
|
||||
|
||||
|
@ -702,15 +776,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
@TargetApi(19)
|
||||
public GeckoResult<PromptResponse> onFilePrompt(GeckoSession session, FilePrompt prompt)
|
||||
{
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
|
||||
if(!helperMethod.checkPermissions((AppCompatActivity)mActivity.get().getApplicationContext())){
|
||||
return GeckoResult.fromValue(prompt.dismiss());
|
||||
}
|
||||
|
||||
// Merge all given MIME types into one, using wildcard if needed.
|
||||
String mimeType = null;
|
||||
String mimeSubtype = null;
|
||||
|
@ -763,7 +833,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
return res;
|
||||
}
|
||||
|
||||
void onFileCallbackResult(final int resultCode, final Intent data) {
|
||||
public void onFileCallbackResult(final int resultCode, final Intent data) {
|
||||
if (mFileResponse == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -774,29 +844,17 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
final FilePrompt prompt = mFilePrompt;
|
||||
mFilePrompt = null;
|
||||
|
||||
if (resultCode != Activity.RESULT_OK || data == null || data.getData()==null) {
|
||||
if (resultCode != Activity.RESULT_OK || data == null) {
|
||||
res.complete(prompt.dismiss());
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = data.getData();
|
||||
|
||||
String filePath = null;
|
||||
|
||||
filePath = PathUtil.getPath(mActivity.get().getApplicationContext(),uri);
|
||||
|
||||
if (filePath==null) {
|
||||
res.complete(prompt.dismiss());
|
||||
return;
|
||||
}
|
||||
|
||||
uri = Uri.parse("file://"+filePath);
|
||||
|
||||
final Uri uri = data.getData();
|
||||
final ClipData clip = data.getClipData();
|
||||
|
||||
if (prompt.type == FilePrompt.Type.SINGLE ||
|
||||
(prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) {
|
||||
res.complete(prompt.confirm(mActivity.get().getApplicationContext(), uri));
|
||||
res.complete(prompt.confirm(mActivity, uri));
|
||||
} else if (prompt.type == FilePrompt.Type.MULTIPLE) {
|
||||
if (clip == null) {
|
||||
Log.w(LOGTAG, "No selected file");
|
||||
|
@ -808,18 +866,18 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
for (int i = 0; i < count; i++) {
|
||||
uris.add(clip.getItemAt(i).getUri());
|
||||
}
|
||||
res.complete(prompt.confirm(mActivity.get().getApplicationContext(), uris.toArray(new Uri[uris.size()])));
|
||||
res.complete(prompt.confirm(mActivity, uris.toArray(new Uri[uris.size()])));
|
||||
}
|
||||
}
|
||||
|
||||
public void onPermissionPrompt(final GeckoSession session, final String title,
|
||||
final GeckoSession.PermissionDelegate.Callback callback) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
callback.reject();
|
||||
return;
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(title)
|
||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
@ -839,11 +897,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
}
|
||||
|
||||
public void onSlowScriptPrompt(GeckoSession geckoSession, String title, GeckoResult<SlowScriptResponse> reportAction) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(title)
|
||||
.setNegativeButton("Wait", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
@ -863,13 +921,13 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
}
|
||||
|
||||
private Spinner addMediaSpinner(final Context context, final ViewGroup container,
|
||||
final MediaSource[] sources, final String[] sourceNames) {
|
||||
final ArrayAdapter<MediaSource> adapter = new ArrayAdapter<MediaSource>(
|
||||
final GeckoSession.PermissionDelegate.MediaSource[] sources, final String[] sourceNames) {
|
||||
final ArrayAdapter<GeckoSession.PermissionDelegate.MediaSource> adapter = new ArrayAdapter<GeckoSession.PermissionDelegate.MediaSource>(
|
||||
context, android.R.layout.simple_spinner_item) {
|
||||
private View convertView(final int position, final View view) {
|
||||
if (view != null) {
|
||||
final MediaSource item = getItem(position);
|
||||
((TextView) view).setText(sourceNames != null ? sourceNames[position] : item.name);
|
||||
final GeckoSession.PermissionDelegate.MediaSource item = getItem(position);
|
||||
((TextView) view).setText(sourceNames != null ? sourceNames[position] : "media");
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
@ -897,15 +955,15 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
}
|
||||
|
||||
public void onMediaPrompt(final GeckoSession session, final String title,
|
||||
final MediaSource[] video, final MediaSource[] audio,
|
||||
final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio,
|
||||
final String[] videoNames, final String[] audioNames,
|
||||
final GeckoSession.PermissionDelegate.MediaCallback callback) {
|
||||
final Activity activity = mActivity.get();
|
||||
final Activity activity = mActivity;
|
||||
if (activity == null || (video == null && audio == null)) {
|
||||
callback.reject();
|
||||
return;
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
final LinearLayout container = addStandardLayout(builder, title, /* msg */ null);
|
||||
|
||||
final Spinner videoSpinner;
|
||||
|
@ -927,10 +985,10 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
final MediaSource video = (videoSpinner != null)
|
||||
? (MediaSource) videoSpinner.getSelectedItem() : null;
|
||||
final MediaSource audio = (audioSpinner != null)
|
||||
? (MediaSource) audioSpinner.getSelectedItem() : null;
|
||||
final GeckoSession.PermissionDelegate.MediaSource video = (videoSpinner != null)
|
||||
? (GeckoSession.PermissionDelegate.MediaSource) videoSpinner.getSelectedItem() : null;
|
||||
final GeckoSession.PermissionDelegate.MediaSource audio = (audioSpinner != null)
|
||||
? (GeckoSession.PermissionDelegate.MediaSource) audioSpinner.getSelectedItem() : null;
|
||||
callback.grant(video, audio);
|
||||
}
|
||||
});
|
||||
|
@ -946,7 +1004,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
|
|||
}
|
||||
|
||||
public void onMediaPrompt(final GeckoSession session, final String title,
|
||||
final MediaSource[] video, final MediaSource[] audio,
|
||||
final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio,
|
||||
final GeckoSession.PermissionDelegate.MediaCallback callback) {
|
||||
onMediaPrompt(session, title, video, audio, null, null, callback);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.content.pm.ActivityInfo;
|
|||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
|
@ -27,7 +26,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.*;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -39,22 +37,18 @@ import androidx.core.graphics.ColorUtils;
|
|||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.fragment.app.FragmentContainerView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||
import com.darkweb.genesissearchengine.constants.*;
|
||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||
import com.darkweb.genesissearchengine.helperManager.animatedColor;
|
||||
import com.darkweb.genesissearchengine.helperManager.autoCompleteAdapter;
|
||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar;
|
||||
import com.example.myapplication.R;
|
||||
import com.google.android.gms.ads.AdView;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -281,7 +275,7 @@ class homeViewController
|
|||
|
||||
public void onHideTabContainer(){
|
||||
if(mTabFragment.getAlpha()>0 || mTabFragment.getVisibility()!=View.GONE){
|
||||
|
||||
Log.i("SUPERFUCK4","SUPERFUCK");
|
||||
mNewTab.setPressed(false);
|
||||
new Handler().postDelayed(() ->
|
||||
{
|
||||
|
@ -289,7 +283,8 @@ class homeViewController
|
|||
mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME);
|
||||
}, 250);
|
||||
|
||||
mTabFragment.animate().setDuration(150).alpha(0f).withEndAction(() -> {
|
||||
mTabFragment.animate().cancel();
|
||||
mTabFragment.animate().setDuration(100).alpha(0f).withEndAction(() -> {
|
||||
mTabFragment.setVisibility(View.GONE);
|
||||
mEvent.invokeObserver(null, enums.etype.M_UPDATE_PIXEL_BACKGROUND);
|
||||
});
|
||||
|
@ -1345,16 +1340,12 @@ class homeViewController
|
|||
{
|
||||
if(msg.what == messages.MESSAGE_ON_URL_LOAD)
|
||||
{
|
||||
Log.i("SUPEEEE","SUPEEE1");
|
||||
if(mEvent.invokeObserver(null, enums.etype.M_HOME_PAGE)==null){
|
||||
mEvent.invokeObserver(null, enums.etype.M_PRELOAD_URL);
|
||||
Log.i("SUPEEEE","SUPEEE2");
|
||||
if(status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)){
|
||||
mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingSearchStatus)), enums.etype.on_url_load);
|
||||
Log.i("SUPEEEE","SUPEEE5");
|
||||
}else {
|
||||
mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), enums.etype.on_url_load);
|
||||
Log.i("SUPEEEE","SUPEEE5");
|
||||
}
|
||||
}
|
||||
if(!status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR) ){
|
||||
|
|
|
@ -324,6 +324,15 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
|||
if(model.getmId()==null){
|
||||
mItemSelectionMenu.setVisibility(View.VISIBLE);
|
||||
mItemSelectionMenuButton.setOnClickListener(this);
|
||||
|
||||
if(status.sTabGridLayoutEnabled){
|
||||
itemView.setVisibility(View.GONE);
|
||||
itemView.setClickable(false);
|
||||
itemView.setFocusable(false);
|
||||
itemView.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
}else {
|
||||
mLoadSession.setOnLongClickListener(this);
|
||||
mRemoveRow.setOnClickListener(this);
|
||||
|
|
|
@ -50,6 +50,7 @@ public class tabController extends Fragment
|
|||
private ImageView mRemoveSelection;
|
||||
private ImageButton mMenuButton;
|
||||
private ImageButton mClearSelection;
|
||||
private ImageButton mNewTab;
|
||||
private TextView mEmptyView;
|
||||
private View mPopupUndo;
|
||||
private TextView mSelectionCount;
|
||||
|
@ -191,8 +192,9 @@ public class tabController extends Fragment
|
|||
mSelectionCount = mRootView.findViewById(R.id.pSelectionCount);
|
||||
mBlocker = mRootView.findViewById(R.id.pBlocker);
|
||||
mNestedScrollView = mRootView.findViewById(R.id.pNestedScroll);
|
||||
mNewTab = mRootView.findViewById(R.id.pNewTab);
|
||||
|
||||
mtabViewController = new tabViewController(this, mTabs, mRemoveSelection, mMenuButton, mClearSelection, mPopupUndo, mSelectionCount, mBlocker, mRecycleView, mNestedScrollView, mEmptyView);
|
||||
mtabViewController = new tabViewController(this, mTabs, mRemoveSelection, mMenuButton, mClearSelection, mPopupUndo, mSelectionCount, mBlocker, mRecycleView, mNestedScrollView, mEmptyView, mNewTab);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
@ -350,6 +352,7 @@ public class tabController extends Fragment
|
|||
mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex));
|
||||
if(mListModel.getList().size()<1){
|
||||
mRecycleView.animate().setDuration(200).alpha(0);
|
||||
onClearSelection(null);
|
||||
}
|
||||
initTabCount(400);
|
||||
activityContextManager.getInstance().getHomeController().onLoadTabFromTabController();
|
||||
|
@ -369,6 +372,7 @@ public class tabController extends Fragment
|
|||
onShowUndoDialog();
|
||||
}
|
||||
mTabAdapter.notifyDataSetChanged();
|
||||
onClearSelection(null);
|
||||
});
|
||||
activityContextManager.getInstance().getHomeController().onLoadTabFromTabController();
|
||||
new Handler().postDelayed(() -> {
|
||||
|
@ -485,6 +489,7 @@ public class tabController extends Fragment
|
|||
mRecycleView.animate().setDuration(200).alpha(0).withEndAction(() -> {
|
||||
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_REMOVE_ALL_SELECTION, null);
|
||||
//onShowUndoDialog();
|
||||
onClearSelection(null);
|
||||
});
|
||||
}else {
|
||||
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_REMOVE_ALL_SELECTION, null);
|
||||
|
@ -525,19 +530,30 @@ public class tabController extends Fragment
|
|||
|
||||
public void onMenuTrigger(View pView){
|
||||
if(pView.getId() == R.id.pNewTab){
|
||||
if(!isSelectionOpened()){
|
||||
onClearTabBackup();
|
||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null);
|
||||
onNewTabInvoked();
|
||||
mHomeController.onBackPressed();
|
||||
mClosedByNewTab = true;
|
||||
}
|
||||
mHomeController.onBackPressed();
|
||||
}
|
||||
if(pView.getId() == R.id.pNewTabMenu){
|
||||
onClearTabBackup();
|
||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null);
|
||||
onNewTabInvoked();
|
||||
mHomeController.onBackPressed();
|
||||
mClosedByNewTab = true;
|
||||
}
|
||||
else if(pView.getId() == R.id.pCloseTab){
|
||||
onExitAndClearBackup();
|
||||
onClearTabBackup();
|
||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null);
|
||||
mRecycleView.animate().setDuration(250).alpha(0).withEndAction(() -> {
|
||||
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REMOVE_ALL, null);
|
||||
onClearSelection(null);
|
||||
|
||||
onClearTabBackup();
|
||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null);
|
||||
});
|
||||
}
|
||||
else if(pView.getId() == R.id.pOpenSetting){
|
||||
|
|
|
@ -52,6 +52,7 @@ class tabViewController
|
|||
private RecyclerView mRecycleView;
|
||||
private NestedScrollView mNestedScrollView;
|
||||
private TextView mEmptyView;
|
||||
private ImageButton mNewTab;
|
||||
|
||||
/*Private Local Variables*/
|
||||
private Handler mDelayHandler = new Handler();
|
||||
|
@ -59,7 +60,7 @@ class tabViewController
|
|||
|
||||
/*Initializations*/
|
||||
|
||||
tabViewController(Fragment mContext, Button pTabs, ImageView pRemoveSelection, ImageButton pMenuButton, ImageButton pClearSelection, View pToastLayoutRoot, TextView pSelectionCount, ImageView pBlocker, RecyclerView pRecycleView, NestedScrollView pNestedScrollView, TextView pEmptyView)
|
||||
tabViewController(Fragment mContext, Button pTabs, ImageView pRemoveSelection, ImageButton pMenuButton, ImageButton pClearSelection, View pToastLayoutRoot, TextView pSelectionCount, ImageView pBlocker, RecyclerView pRecycleView, NestedScrollView pNestedScrollView, TextView pEmptyView, ImageButton pNewTab)
|
||||
{
|
||||
this.mContext = mContext;
|
||||
this.mTabs = pTabs;
|
||||
|
@ -72,6 +73,7 @@ class tabViewController
|
|||
this.mRecycleView = pRecycleView;
|
||||
this.mNestedScrollView = pNestedScrollView;
|
||||
this.mEmptyView = pEmptyView;
|
||||
this.mNewTab = pNewTab;
|
||||
|
||||
initUI();
|
||||
initPostUI();
|
||||
|
@ -139,6 +141,11 @@ class tabViewController
|
|||
mMenuButton.setVisibility(View.GONE);
|
||||
mSelectionCount.setVisibility(View.VISIBLE);
|
||||
mClearSelection.setVisibility(View.VISIBLE);
|
||||
|
||||
mNewTab.setVisibility(View.GONE);
|
||||
mNewTab.animate().setDuration(250).alpha(0);
|
||||
mNewTab.setEnabled(false);
|
||||
mNewTab.setFocusable(false);
|
||||
}
|
||||
|
||||
private void onShowSelectionMenu(boolean pStatus, int pCount) {
|
||||
|
@ -157,6 +164,11 @@ class tabViewController
|
|||
mClearSelection.setVisibility(View.GONE);
|
||||
mMenuButton.setVisibility(View.VISIBLE);
|
||||
mTabs.animate().setStartDelay(0).setDuration(250).alpha(1);
|
||||
|
||||
mNewTab.setVisibility(View.VISIBLE);
|
||||
mNewTab.animate().setDuration(250).alpha(1);
|
||||
mNewTab.setEnabled(true);
|
||||
mNewTab.setFocusable(true);
|
||||
}
|
||||
|
||||
private void onShowUndoDialog(int pTabCount) {
|
||||
|
|
|
@ -83,6 +83,7 @@ public class constants
|
|||
|
||||
/*ENCRYPTION KEY*/
|
||||
public static final String CONST_ENCRYPTION_KEY = "Zr4u7x!A%D*F-JaNdRgUkXp2s5v8y/B?";
|
||||
public static final String CONST_ENCRYPTION_KEY_DATABASE = "Zr4u7x!!A%D*F-JaNdsS@@gUbbp^^5v8y/B?";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.darkweb.genesissearchengine.databaseManager;
|
|||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
|
||||
|
@ -10,12 +9,17 @@ import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel
|
|||
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
|
||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
|
||||
import com.darkweb.genesissearchengine.constants.constants;
|
||||
import net.sqlcipher.database.SQLiteDatabaseHook;
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME;
|
||||
|
||||
|
||||
public class databaseController
|
||||
{
|
||||
|
@ -23,7 +27,7 @@ public class databaseController
|
|||
/*Private Variables*/
|
||||
|
||||
private static final databaseController sOurInstance = new databaseController();
|
||||
private SQLiteDatabase mDatabaseInstance;
|
||||
private static SQLiteDatabase mDatabaseInstance;
|
||||
|
||||
public static databaseController getInstance()
|
||||
{
|
||||
|
@ -36,11 +40,21 @@ public class databaseController
|
|||
|
||||
/*Initializations*/
|
||||
|
||||
public void prepareDatabaseEnvironment(AppCompatActivity app_context) {
|
||||
File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME);
|
||||
|
||||
if (!databaseFile.exists()) {
|
||||
databaseFile.getParentFile().mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize(AppCompatActivity app_context)
|
||||
{
|
||||
try
|
||||
{
|
||||
mDatabaseInstance = app_context.openOrCreateDatabase(constants.CONST_DATABASE_NAME, MODE_PRIVATE, null);
|
||||
SQLiteDatabase.loadLibs(app_context);
|
||||
prepareDatabaseEnvironment(app_context);
|
||||
mDatabaseInstance = mDatabaseInstance.openOrCreateDatabase(app_context.getDatabasePath(CONST_DATABASE_NAME), constants.CONST_ENCRYPTION_KEY_DATABASE,null, wrapHook(null));
|
||||
|
||||
mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);");
|
||||
mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4) PRIMARY KEY,title VARCHAR,url VARCHAR);");
|
||||
|
@ -56,6 +70,37 @@ public class databaseController
|
|||
|
||||
/*Helper Methods*/
|
||||
|
||||
public SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) {
|
||||
if (hook == null)
|
||||
{
|
||||
return keyHook;
|
||||
}
|
||||
return new SQLiteDatabaseHook() {
|
||||
@Override
|
||||
public void preKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) {
|
||||
keyHook.preKey(sqLiteDatabase);
|
||||
hook.preKey(sqLiteDatabase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) {
|
||||
keyHook.postKey(sqLiteDatabase);
|
||||
hook.preKey(sqLiteDatabase);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SQLiteDatabaseHook keyHook = new SQLiteDatabaseHook() {
|
||||
@Override
|
||||
public void preKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
public void execSQL(String query,String[] params)
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
|
|||
try {
|
||||
URL url = new URL(f_url[0]);
|
||||
Proxy proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(PROXY_ADDRESS, PROXY_PORT));
|
||||
URLConnection conection= null;
|
||||
URLConnection conection;
|
||||
|
||||
conection = url.openConnection(proxy);
|
||||
//conection = (HttpsURLConnection)ProxySelector.openConnectionWithProxy(new URI(f_url[0]));
|
||||
|
|
Loading…
Reference in New Issue