diff --git a/app/build.gradle b/app/build.gradle index 7629b10f..5748934c 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -134,6 +134,7 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0' implementation 'com.google.android.material:material:1.2.1' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } /* Automated APK Generation */ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1b423aba..3dfd486e 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,6 @@ - @@ -15,19 +14,21 @@ + + @@ -55,7 +56,7 @@ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:windowSoftInputMode="adjustPan" /> - + @@ -144,13 +147,12 @@ - - - - + + @@ -191,19 +193,16 @@ - - - + + - - - - + - + android:value="ca-app-pub-6985886044951738~4177628900" /> + --> - - - - - - - - + android:authorities="org.torproject.android.ui.v3onionservice.genesis.clientauth" + android:exported="false" /> - - - \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java index 2dae71b6..ed579d66 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java @@ -3,7 +3,7 @@ package com.darkweb.genesissearchengine.appManager; import android.content.Context; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkController; import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingController.java new file mode 100644 index 00000000..869b836f --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingController.java @@ -0,0 +1,175 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import android.content.res.Configuration; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; + +import org.mozilla.geckoview.GeckoSession; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class bookmarkSettingController extends AppCompatActivity { + + /* Private Variables */ + + private bookmarkSettingModel mBookmarkSettingModel; + private bookmarkSettingViewController mBookmarkSettingViewController; + + /* UI Variables */ + + private EditText mBookmarName; + private EditText mBookmarURL; + + private TextView mBookmarkNameError; + private TextView mBookmarkURLError; + + /* Initializations */ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + activityContextManager.getInstance().onStack(this); + + super.onCreate(savedInstanceState); + setContentView(R.layout.bookmark_setting_view); + + initializeViews(); + initializeModels(); + initializeLocalEventHandlers(); + } + + private void initializeViews() { + mBookmarName = findViewById(R.id.pBookmarkName); + mBookmarURL = findViewById(R.id.pBookmarkURL); + mBookmarkNameError = findViewById(R.id.pBookmarkNameError); + mBookmarkURLError = findViewById(R.id.pBookmarkURLError); + } + + private void initializeLocalEventHandlers() { + + + TextWatcher mTextWatcher = new TextWatcher() { + @Override + public void afterTextChanged(Editable s) { + String mBookmarkName = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME); + String mBookmarkURL = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_URL); + mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM, Arrays.asList(mBookmarkName, mBookmarkURL)); + } + + @Override + public void beforeTextChanged(CharSequence s, int start,int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start,int before, int count) { + + } + }; + + mBookmarName.addTextChangedListener(mTextWatcher); + mBookmarURL.addTextChangedListener(mTextWatcher); + } + + public void initializeModels(){ + String mBookmarkName = getIntent().getStringExtra(keys.BOOKMARK_SETTING_NAME); + String mBookmarkURL = getIntent().getStringExtra(keys.BOOKMARK_SETTING_URL); + int mBookmarkID = getIntent().getIntExtra(keys.BOOKMARK_SETTING_ID, -1); + + mBookmarkSettingViewController = new bookmarkSettingViewController(this, new bookmarkSettingViewCallback(), mBookmarName, mBookmarURL, mBookmarkNameError, mBookmarkURLError); + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_INITIALIZE, Arrays.asList(mBookmarkName,mBookmarkURL)); + mBookmarkSettingModel = new bookmarkSettingModel(this, new bookmarkSettingModelCallback(), mBookmarkID); + } + + /* Local Override */ + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + /* UI Redirection */ + + public void onClose(View view){ + finish(); + } + + public void onUpdateBookmark(View view) { + String mBookmarkName = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME); + String mBookmarkURL = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_URL); + mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_UPDATE_BOOKMARK, Arrays.asList(mBookmarkName, mBookmarkURL)); + } + + /* UI Callbacks */ + + private class bookmarkSettingViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + private class bookmarkSettingModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List pData, Object pType) + { + if(pType.equals(bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_NAME_VALIDATION_ERROR)){ + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_ERROR, pData); + } + else if(pType.equals(bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_URL_VALIDATION_ERROR)){ + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_URL_VALIDATION_ERROR, pData); + } + else if(pType.equals(bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_CLEAR_FORM)){ + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM); + } + else if(pType.equals(bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_CLOSE)){ + onClose(null); + } + return null; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingEnums.java new file mode 100644 index 00000000..e88c7462 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingEnums.java @@ -0,0 +1,20 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings; + +public class bookmarkSettingEnums +{ + public enum eBookmarkSettingViewCommands { + M_INITIALIZE, M_GET_BOOKMARK_NAME, M_GET_BOOKMARK_URL, M_BOOKMARK_NAME_VALIDATION_ERROR, M_BOOKMARK_URL_VALIDATION_ERROR, M_CLEAR_FORM + } + + public enum eBookmarkSettingModelCommands { + M_GET_BOOKMARK_ID, M_UPDATE_BOOKMARK, M_CLOSE, M_VALIDATE_FORM + } + + public enum eBookmarkSettingViewAdapterCommands { + } + + public enum eBookmarkSettingModelCallbackCommands { + M_CLEAR_FORM, M_BOOKMARK_NAME_VALIDATION_ERROR, M_BOOKMARK_URL_VALIDATION_ERROR,M_CLOSE + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingModel.java new file mode 100644 index 00000000..e5dd17da --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingModel.java @@ -0,0 +1,79 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static com.darkweb.genesissearchengine.constants.strings.BOOKMARK_SETTING_VALIDATION_ERROR_1; +import static com.darkweb.genesissearchengine.constants.strings.BOOKMARK_SETTING_VALIDATION_ERROR_2; + +class bookmarkSettingModel +{ + /* Private Variables */ + + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private int mBookmarkID; + + public bookmarkSettingModel(AppCompatActivity pContext, eventObserver.eventListener pEvent, int pBookmarkID){ + this.mContext = pContext; + this.mEvent = pEvent; + this.mBookmarkID = pBookmarkID; + } + + /* Helper Methods */ + + private int getBookarkID(){ + return mBookmarkID; + } + + private void onUpdateBookmark(String pBookmarkName, String pBookmarkURL){ + boolean status = validateForm(pBookmarkName, pBookmarkURL); + if(status){ + dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_UPDATE_BOOKMARK, Arrays.asList(pBookmarkName, pBookmarkURL, mBookmarkID)); + mEvent.invokeObserver(null, bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_CLOSE); + } + } + + private boolean validateForm(String pBookmarkName, String pBookmarkURL){ + mEvent.invokeObserver(null, bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_CLEAR_FORM); + boolean mStatus = true; + if(pBookmarkName.equals(strings.GENERIC_EMPTY_STR)){ + mEvent.invokeObserver(Arrays.asList(BOOKMARK_SETTING_VALIDATION_ERROR_1, false), bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_NAME_VALIDATION_ERROR); + mStatus = false; + }else { + mEvent.invokeObserver(Arrays.asList(BOOKMARK_SETTING_VALIDATION_ERROR_1, true), bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_NAME_VALIDATION_ERROR); + } + if(pBookmarkURL.equals(strings.GENERIC_EMPTY_STR)){ + mEvent.invokeObserver(Arrays.asList(strings.BOOKMARK_SETTING_VALIDATION_ERROR_2, false), bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_URL_VALIDATION_ERROR); + mStatus = false; + }else { + mEvent.invokeObserver(Arrays.asList(BOOKMARK_SETTING_VALIDATION_ERROR_2, true), bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_URL_VALIDATION_ERROR); + } + + return mStatus; + } + + /* Event Observer */ + + public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands pCommands, List pData){ + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_GET_BOOKMARK_ID.equals(pCommands)){ + return getBookarkID(); + } + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_UPDATE_BOOKMARK.equals(pCommands)){ + onUpdateBookmark((String) pData.get(0), (String) pData.get(1)); + } + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM.equals(pCommands)){ + validateForm((String) pData.get(0), (String) pData.get(1)); + } + return null; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingViewController.java new file mode 100644 index 00000000..2762a4e6 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingViewController.java @@ -0,0 +1,131 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings; + +import android.widget.EditText; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.example.myapplication.R; + +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; +import java.util.List; + +import static com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings.bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_NAME_VALIDATION_ERROR; +import static com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings.bookmarkSettingEnums.eBookmarkSettingModelCallbackCommands.M_BOOKMARK_URL_VALIDATION_ERROR; + +class bookmarkSettingViewController +{ + /* Private Variables */ + + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + + /* UI Variables */ + + private EditText mBookmarName; + private EditText mBookmarURL; + + private TextView mBookmarkNameError; + private TextView mBookmarkURLError; + + /* Initializations */ + + bookmarkSettingViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent,EditText pBookmarName,EditText pBookmarURL, TextView pBookmarkNameError, TextView pBookmarkURLError) + { + this.mContext = pContext; + this.mEvent = pEvent; + + this.mBookmarName = pBookmarName; + this.mBookmarURL = pBookmarURL; + this.mBookmarkNameError = pBookmarkNameError; + this.mBookmarkURLError = pBookmarkURLError; + + initPostUI(); + } + + private void initPostUI(){ + sharedUIMethod.updateStatusBar(mContext); + } + + private void initializeBookmark(String pBookmarkName, String pBookmarkURL){ + mBookmarName.setText(pBookmarkName); + mBookmarURL.setText(pBookmarkURL); + } + + private String getBookmarkName(){ + return mBookmarName.getText().toString(); + } + + private String getBookmarkURL(){ + return mBookmarURL.getText().toString(); + } + + private void mBookmarkNameValidationError(bookmarkSettingEnums.eBookmarkSettingViewCommands pCommands, String pMessage, boolean pStatus){ + try { + if(pCommands.equals(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_ERROR)){ + if(!pStatus){ + mBookmarName.setBackground(helperMethod.getDrawableXML(mContext, R.xml.gx_generic_input_error)); + mBookmarkNameError.animate().setDuration(150).alpha(1); + mBookmarkNameError.setText(pMessage); + }else { + mBookmarName.setBackground(helperMethod.getDrawableXML(mContext, R.xml.gx_generic_input)); + mBookmarkNameError.animate().setDuration(150).alpha(0); + mBookmarkNameError.setText(pMessage); + } + } + if(pCommands.equals(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_URL_VALIDATION_ERROR)){ + if(!pStatus){ + mBookmarURL.setBackground(helperMethod.getDrawableXML(mContext, R.xml.gx_generic_input_error)); + mBookmarkURLError.animate().setDuration(150).alpha(1); + mBookmarkURLError.setText(pMessage); + }else { + mBookmarURL.setBackground(helperMethod.getDrawableXML(mContext, R.xml.gx_generic_input)); + mBookmarkURLError.animate().setDuration(150).alpha(0); + mBookmarkURLError.setText(pMessage); + } + } + } catch (Exception ignored) { + } + } + + private void onClearForm(){ + try { + mBookmarName.setBackground(helperMethod.getDrawableXML(mContext, R.xml.gx_generic_input)); + mBookmarURL.setBackground(helperMethod.getDrawableXML(mContext, R.xml.gx_generic_input)); + + } catch (Exception ignored) { + } + + } + + /* Event Observer */ + + public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands pCommands, List pData){ + if(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_INITIALIZE.equals(pCommands)){ + initializeBookmark((String)pData.get(0), (String) pData.get(1)); + } + if(pCommands.equals(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_ERROR) || pCommands.equals(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_URL_VALIDATION_ERROR)){ + mBookmarkNameValidationError(pCommands, (String)pData.get(0), (boolean)pData.get(1)); + } + return null; + } + + public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands pCommands){ + if(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME.equals(pCommands)){ + return getBookmarkName(); + } + else if(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_URL.equals(pCommands)){ + return getBookmarkURL(); + } + else if(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM.equals(pCommands)){ + onClearForm(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java index 0e345edd..a98aae63 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; +package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; import android.annotation.SuppressLint; import android.content.Context; @@ -19,7 +19,6 @@ import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -158,7 +157,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter0){ mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false)); } + + mBookmarkEdit.setOnClickListener(this::onClick); + } + + @Override + public void onClick(View view) { + if(view.getId() == R.id.pBookmarkEdit){ + mEvent.invokeObserver(Arrays.asList(mHeader.getText(), mDescription.getText(), mModelList.get(getLayoutPosition()).getID()), enums.etype.M_OPEN_BOOKMARK_SETTING); + } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java index 1f7f7c9e..07a66ab3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; +package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkController.java old mode 100755 new mode 100644 similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkController.java index d70f7b9e..72d59393 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkController.java @@ -1,6 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; +package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; import android.content.Context; +import android.content.Intent; import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Rect; @@ -23,6 +24,7 @@ import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.BookmarkSettings.bookmarkSettingController; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; @@ -43,7 +45,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; -import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU; +import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU; import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_BOOKMARK; @@ -54,10 +56,10 @@ public class bookmarkController extends AppCompatActivity private bookmarkModel mbookmarkModel; private homeController mHomeController; - private activityContextManager mContextManager; private bookmarkAdapter mbookmarkAdapter; private LinearLayout mHeaderContainer; private TextView mTitle; + /*Private Views*/ private ImageView mEmptyListNotification; @@ -96,10 +98,9 @@ public class bookmarkController extends AppCompatActivity public void initializeListModel(){ mbookmarkModel = new bookmarkModel(); - mContextManager = activityContextManager.getInstance(); mHomeController = activityContextManager.getInstance().getHomeController(); - mContextManager.setBookmarkController(this); } + public void initializeViews(){ mEmptyListNotification = findViewById(R.id.pEmptyListNotification); mSearchInput = findViewById(R.id.pSearchInput); @@ -248,6 +249,10 @@ public class bookmarkController extends AppCompatActivity activityContextManager.getInstance().setCurrentActivity(this); status.sSettingIsAppPaused = false; activityContextManager.getInstance().onStack(this); + if(mbookmarkAdapter!=null){ + mbookmarkAdapter.notifyDataSetChanged(); + } + super.onResume(); } @@ -271,7 +276,7 @@ public class bookmarkController extends AppCompatActivity } } - /*External XML Listeners*/ + /* UI Redirection */ public void onBackPressed(View view){ onBackPressed(); @@ -323,6 +328,13 @@ public class bookmarkController extends AppCompatActivity mRecycleView.setAlpha(0); } + public void onOpenBookmarkSetting() { + Intent intent = new Intent(getApplicationContext(), bookmarkSettingController.class); + startActivity(intent); + } + + /*Event Observer*/ + public class edittextManagerCallback implements eventObserver.eventListener { @Override @@ -335,8 +347,6 @@ public class bookmarkController extends AppCompatActivity } } - /*Event Observer*/ - public class adapterCallback implements eventObserver.eventListener{ @Override public Object invokeObserver(List data, Object e_type) @@ -370,6 +380,13 @@ public class bookmarkController extends AppCompatActivity else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){ mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data); } + else if(e_type.equals(enums.etype.M_OPEN_BOOKMARK_SETTING)){ + Intent intent = new Intent(getApplicationContext(), bookmarkSettingController.class); + intent.putExtra(keys.BOOKMARK_SETTING_NAME, (String) data.get(0)); + intent.putExtra(keys.BOOKMARK_SETTING_URL, (String) data.get(1)); + intent.putExtra(keys.BOOKMARK_SETTING_ID, (int) data.get(2)); + startActivity(intent); + } return null; } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java index 1190a12b..428f9f4b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; +package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; public class bookmarkEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java old mode 100755 new mode 100644 similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkModel.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java index c6bf6439..ae54a827 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; +package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; @@ -17,13 +17,13 @@ class bookmarkModel mModelList = model; } - private void removeFromMainList(int index) + private void removeFromList(int index) { mModelList.remove(index); } void onManualClear(int index){ - removeFromMainList(index); + removeFromList(index); } void clearList(){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java old mode 100755 new mode 100644 similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java index 3d58e907..53e46012 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; +package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; import android.content.Context; import android.graphics.Bitmap; @@ -7,7 +7,6 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.os.Build; -import android.os.Handler; import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -29,15 +28,11 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; -import java.util.Arrays; import java.util.List; import java.util.Objects; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java index f0a786d6..b4130698 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java @@ -192,7 +192,7 @@ public class geckoClients mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE ); mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); onUpdateFont(); - onReload(mNestedGeckoView, pcontext); + onReload(mNestedGeckoView, pcontext,false); } public void resetSession(){ @@ -308,7 +308,7 @@ public class geckoClients public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ if(mSession.canGoBack()){ mSession.goBackSession(); - mSession.onUpdateBannerAdvert(); + //mSession.onUpdateBannerAdvert(); } else if(isFinishAllowed){ if(mSession.getRemovableFromBackPressed() && mTabSize>1){ @@ -362,12 +362,12 @@ public class geckoClients mSession.stop(); } - public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext, boolean isThemeCall){ mSession.stop(); String url = mSession.getCurrentURL(); if(url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){ loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); - }else{ + }else if(!isThemeCall){ mSession.reload(); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java index cddb1803..5a651488 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java @@ -29,6 +29,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; @@ -74,6 +75,7 @@ import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static com.darkweb.genesissearchengine.constants.enums.etype.M_DEFAULT_BROWSER; import static com.darkweb.genesissearchengine.constants.enums.etype.M_RATE_COUNT; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_APPLICATION_CRASH; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; @@ -1081,8 +1083,18 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes goBack(); try { - if (mHistoryList!=null && mHistoryList.size()>=1) - event.invokeObserver(Arrays.asList(mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri(),mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + if (mHistoryList!=null && mHistoryList.size()>=1){ + if(mHistoryList.getCurrentIndex()-1>=0 && mHistoryList.getCurrentIndex()-1 + { + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); + }, 0); + } + } + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.ON_FIRST_PAINT); + } }catch (Exception ignored){} } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java index 659f52e1..d1613fdc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java @@ -44,7 +44,7 @@ import androidx.fragment.app.FragmentContainerView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; @@ -95,12 +95,12 @@ import java.util.Objects; import java.util.concurrent.Callable; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; +import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN_MOVE; import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_MOVE; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; @@ -204,19 +204,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba super.onCreate(savedInstanceState); setContentView(R.layout.home_view); - /* Thread.setDefaultUncaughtExceptionHandler((t, e) -> { - status.sSettingIsAppStarted = false; - finishAndRemoveTask(); - - Intent intent = new Intent(this, homeController.class); - intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); - intent.putExtra("crash",true); - this.startActivity(intent); - this.finish(); - - Runtime.getRuntime().exit(0); - }); */ - initPreFixes(); activityContextManager.getInstance().setHomeController(this); pluginController.getInstance().initializeAllServices(this); @@ -594,8 +581,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession)); } - if(mTempSession.isOpen()){ - if(mTempSession.getSessionID().equals(mGeckoClient.getSession().getSessionID())){ + if(mTempSession.isOpen() ){ + Log.i("SUPERFUCKKKKK", "SUPERFUCKKKKK : " + (mTempSession.getSessionID()==null) + " -- " + (mGeckoClient == null) + " -- " + (mGeckoClient.getSession().getSessionID() == null)); + if(mGeckoClient.getSession()!=null && mTempSession.getSessionID().equals(mGeckoClient.getSession().getSessionID())){ return; } } @@ -1177,11 +1165,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onOpenTabViewBoundary(View view){ - onInvokePixelGenerator(); if(mScrollHandler!=null){ - mScrollHandler.removeCallbacksAndMessages(null); + // mScrollHandler.removeCallbacksAndMessages(null); } - onInvokePixelGenerator(); + // onInvokePixelGenerator(); mNewTab.setPressed(true); onOpenTabReady(); } @@ -1441,7 +1428,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(status.sSettingIsAppStarted && !status.mThemeApplying){ if(mGeckoClient.getSession().wasPreviousErrorPage()){ pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); - mGeckoClient.onReload(mGeckoView, this); + mGeckoClient.onReload(mGeckoView, this, false); } } @@ -1735,7 +1722,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba { pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NEW_IDENTITY); - mGeckoClient.onReload(mGeckoView, this); + mGeckoClient.onReload(mGeckoView, this, false); } else if (menuId == R.id.pMenuOpenCurrentTab) { @@ -1810,7 +1797,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (menuId == R.id.menu26 || menuId == R.id.menu27) { helperMethod.hideKeyboard(this); mGeckoClient.toogleUserAgent(); - mGeckoClient.onReload(mGeckoView, homeController.this); + mGeckoClient.onReload(mGeckoView, homeController.this, false); } if(menuId == R.id.menu25){ helperMethod.hideKeyboard(this); @@ -1824,14 +1811,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(status.mThemeApplying){ if(status.sTheme == enums.Theme.THEME_DARK){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); }else if(status.sTheme == enums.Theme.THEME_LIGHT){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); }else { if(!status.sDefaultNightMode){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); }else { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); } } } @@ -1861,7 +1848,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); @@ -2196,7 +2183,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onInvokePixelGenerator(){ - if(mTabFragment==null || mTabFragment.getVisibility()==View.VISIBLE){ + if(mNewTab.isPressed() || mTabFragment==null || mTabFragment.getVisibility()==View.VISIBLE){ return; } @@ -2209,9 +2196,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba try{ mRenderedBitmap = mGeckoView.capturePixels(); - }catch (Exception ex){ - Log.i("FIZZAHFUCK1","asd : " + ex.getMessage()); - } + }catch (Exception ignored){} new Handler().postDelayed(() -> { if(mTabFragment!=null && mGeckoClient.getSession()!=null){ @@ -2250,6 +2235,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){ Object mAdvertResponse = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED); if(mAdvertResponse != null){ + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); mHomeViewController.updateBannerAdvertStatus((boolean)data.get(3), (boolean)mAdvertResponse); } } @@ -2300,7 +2286,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true)); mHomeViewController.onPageFinished(); mGeckoClient.onRedrawPixel(homeController.this); - mHomeViewController.onFullScreen(true); } else if(e_type.equals(M_RATE_APPLICATION)){ if(!status.sSettingIsAppRated){ @@ -2379,6 +2364,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ onInvokePixelGenerator(); + mHomeViewController.onFullScreen(true); } else if(e_type.equals(enums.etype.M_INIT_PADDING)){ mHomeViewController.initTopBarPadding(); @@ -2400,7 +2386,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.M_NEW_IDENTITY_MESSAGED)){ pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_NEW_IDENTITY); - mGeckoClient.onReload(mGeckoView, homeController.this); + mGeckoClient.onReload(mGeckoView, homeController.this, false); } return null; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java index fa21337f..f1cafaf9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java @@ -595,8 +595,8 @@ class homeViewController initSplashLoading(); }); mGatewaySplash.animate().setDuration(350).alpha(0.4f); - mPanicButton.animate().setDuration(250).alpha(0f); - mPanicButtonLandscape.animate().setDuration(250).alpha(0f); + mPanicButtonLandscape.animate().setDuration(200).translationXBy(helperMethod.pxFromDp(50)); + mPanicButton.animate().setDuration(200).translationXBy(helperMethod.pxFromDp(50)); } private void initSplashScreen(){ @@ -930,10 +930,12 @@ class homeViewController mBannerAds.setVisibility(View.GONE); } } + onFullScreen(false); } void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded){ - if(status && pIsAdvertLoaded){ + Object mCurrentURL = mEvent.invokeObserver(null, enums.etype.M_GET_CURRENT_URL); + if(status && pIsAdvertLoaded && !((String)mCurrentURL).contains("genesis")){ if(mBannerAds.getAlpha()==0){ mBannerAds.animate().cancel(); mBannerAds.setAlpha(0); @@ -941,19 +943,20 @@ class homeViewController mBannerAds.setVisibility(View.VISIBLE); } onSetBannerAdMargin(true,true); - }else{ + } /* else if(mBannerAds.getVisibility() != View.VISIBLE){ if(mBannerAds.getAlpha()==1){ mBannerAds.animate().cancel(); mBannerAds.animate().alpha(0).withEndAction(() -> mBannerAds.setVisibility(View.GONE)); } onSetBannerAdMargin(false,true); - } + } */ } private Handler searchBarUpdateHandler = new Handler(); private String handlerLocalUrl = ""; void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText, boolean pBypassFocus){ + if(url.endsWith("genesisconfigurenewidentity.com/")){ return; } @@ -1397,7 +1400,10 @@ class homeViewController } if(pStatus){ - onProgressBarUpdate(100, false); + if(mProgressBar.getAlpha()>0){ + onProgressBarUpdate(100, false); + } + this.mBlockerFullSceen.setVisibility(View.VISIBLE); this.mBlockerFullSceen.setAlpha(0f); this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(1).withEndAction(() -> { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java index 2eff5fda..6b0fb61a 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java @@ -21,14 +21,12 @@ import java.util.Collections; public class landingController extends AppIntro { - private landingViewController mLauncherViewController; + private landingViewController mLandingViewController; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Instead of fragments, you can also use our default slide - // Just set a title, description, background and image. AppIntro will do the rest. CustomSlideBigText welcome = CustomSlideBigText.newInstance(R.layout.landing_view); welcome.setTitle(getString(R.string.LANDING_HELLO)); welcome.setSubTitle(getString(R.string.LANDING_WELCOME)); @@ -49,20 +47,16 @@ public class landingController extends AppIntro { }); addSlide(cs2); - - // OPTIONAL METHODS - // Override bar/separator color. setBarColor(getResources().getColor(R.color.landing_ease_blue)); setSeparatorColor(getResources().getColor(R.color.headerblack)); - // Hide Skip/Done button. showSkipButton(false); setProgressButtonEnabled(true); initConnections(); } private void initConnections(){ - mLauncherViewController = new landingViewController(this,null); + mLandingViewController = new landingViewController(this,null); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java index 427c5650..a6c94ff3 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java @@ -11,6 +11,7 @@ import com.example.myapplication.R; class landingViewController { /*Private Variables*/ + private AppCompatActivity mContext; /*Initializations*/ @@ -23,16 +24,6 @@ class landingViewController } private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java index af4f3e76..6538cb62 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java @@ -2,7 +2,6 @@ package com.darkweb.genesissearchengine.appManager.orbotManager; import android.content.res.Configuration; import android.os.Bundle; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.widget.LinearLayout; @@ -107,7 +106,7 @@ public class orbotController extends AppCompatActivity { public void onVPNSwitch(View view){ mOrbotModel.onTrigger(orbotEnums.eOrbotModelCommands.M_VPN_SWITCH,Collections.singletonList(!mVpnSwitch.isChecked())); mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_VPN,Collections.singletonList(status.sVPNStatus)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,status.sVPNStatus)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sVPNStatus)); } public void onClose(View view){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java index a346e8b0..590a3116 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java @@ -11,7 +11,6 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeEnums; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; @@ -190,7 +189,7 @@ public class settingClearController extends AppCompatActivity { dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java index 71242d32..7736cf6d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Bundle; +import android.os.Handler; import android.view.View; import android.widget.RadioButton; import android.widget.TextView; @@ -12,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.languageManager.languageController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; @@ -31,6 +33,8 @@ import java.util.Collections; import java.util.List; import java.util.Locale; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_APPLICATION_CRASH; + public class settingGeneralController extends AppCompatActivity { /* PRIVATE VARIABLES */ @@ -50,6 +54,7 @@ public class settingGeneralController extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { + onInitTheme(); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); super.onCreate(savedInstanceState); if(!status.mThemeApplying){ @@ -61,6 +66,23 @@ public class settingGeneralController extends AppCompatActivity { viewsInitializations(); } + private void onInitTheme(){ + + if(status.mThemeApplying){ + if(status.sTheme == enums.Theme.THEME_DARK){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + }else if(status.sTheme == enums.Theme.THEME_LIGHT){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + }else { + if(!status.sDefaultNightMode){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + }else { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } + } + } + } + @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); @@ -101,24 +123,20 @@ public class settingGeneralController extends AppCompatActivity { boolean mIsThemeChangable = false; if(status.sTheme == enums.Theme.THEME_DARK){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); mIsThemeChangable = true; } } else if(status.sTheme == enums.Theme.THEME_LIGHT){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); mIsThemeChangable = true; } }else { if(!status.sDefaultNightMode){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); mIsThemeChangable = true; } }else { if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); mIsThemeChangable = true; } } @@ -128,9 +146,14 @@ public class settingGeneralController extends AppCompatActivity { status.mThemeApplying = true; onBackPressed(); overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - activityContextManager.getInstance().getHomeController().onReInitTheme(); - activityContextManager.getInstance().getSettingController().onReInitTheme(); helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true); + + + new Handler().postDelayed(() -> + { + activityContextManager.getInstance().getHomeController().onReInitTheme(); + activityContextManager.getInstance().getSettingController().onReInitTheme(); + }, 100); } } return null; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java index 2233ff19..c8ad8063 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java @@ -14,6 +14,8 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; + import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager; @@ -28,6 +30,7 @@ import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager. import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.dataManager.dataController; @@ -46,6 +49,7 @@ import java.util.Collections; import java.util.List; import java.util.Locale; +import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; public class settingHomeController extends AppCompatActivity @@ -87,6 +91,23 @@ public class settingHomeController extends AppCompatActivity super.onConfigurationChanged(newConfig); } + private void onInitTheme(){ + + if(status.mThemeApplying){ + if(status.sTheme == enums.Theme.THEME_DARK){ + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + }else if(status.sTheme == enums.Theme.THEME_LIGHT){ + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + }else { + if(!status.sDefaultNightMode){ + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + }else { + setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } + } + } + } + private void viewsInitializations() { activityContextManager.getInstance().setSettingController(this); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java index 9706f016..5f10130d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java @@ -8,6 +8,7 @@ import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -388,9 +389,10 @@ public class tabAdapter extends RecyclerView.Adapter mWebThumbnail.setImageBitmap(model.getBitmap()); }else { Drawable mDrawable = new BitmapDrawable(itemView.getContext().getResources(), model.getBitmap()); - helperMethod.setImageDrawableWithAnimation(mWebThumbnail, mDrawable,250); + helperMethod.setImageDrawableWithAnimation(mWebThumbnail, mDrawable,150); } - }, 1 * getLayoutPosition()); + Log.i("SUPERFFF", "SUPERFFF : " + getLayoutPosition()); + }, getLayoutPosition()); } if(mSelectedList.contains(model.getSession().getSessionID())){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java index e1c262e7..07813427 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java @@ -35,6 +35,7 @@ import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; @@ -43,6 +44,8 @@ import java.util.List; import java.util.Objects; import static com.darkweb.genesissearchengine.appManager.tabManager.tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_FORCED; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_RESET; +import static org.mozilla.gecko.util.ThreadUtils.runOnUiThread; public class tabController extends Fragment { @@ -165,7 +168,7 @@ public class tabController extends Fragment } public void onInitFirstElement(){ - mHomeController.runOnUiThread(() -> { + runOnUiThread(() -> { if(mTabAdapter!=null){ if(mBlocker.getVisibility() != View.VISIBLE){ mTabAdapter.notifyItemChanged(0); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java index a6acbd4d..e2f0e3a7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -7,7 +7,7 @@ public class enums M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon,M_RELOAD,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE,ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_INIT_PADDING, M_RATE_COUNT,M_CACHE_UPDATE_TAB,M_DEFAULT_BROWSER, on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, M_ADVERT_LOADED, welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION, - url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, M_COPY_URL,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, + url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,M_OPEN_BOOKMARK_SETTING, M_COPY_URL,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java index 7745a57e..da9b48df 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -64,7 +64,12 @@ public class keys public static final String BRIDGE_CUSTOM_BRIDGE_1 = "CLEAR_PREFS_V1"; public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE_V1"; public static final String BRIDGE_ENABLES = "pref_bridges_enabled_V1"; - public static final String VPN_ENABLED = "pref_vpn_V1"; + public static final String BRIDGE_VPN_ENABLED = "pref_vpn_V1"; public static final String BRIDGE_DEFAULT = "BRIDGE_DEFAULT"; + /*Bookmark Settings*/ + + public static final String BOOKMARK_SETTING_NAME = "BOOKMARK_SETTING_NAME"; + public static final String BOOKMARK_SETTING_URL = "BOOKMARK_SETTING_URL"; + public static final String BOOKMARK_SETTING_ID = "BOOKMARK_SETTING_ID"; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 7eb15b78..f5d2ad59 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -104,7 +104,7 @@ public class status status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); status.sSettingIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,false)); status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); status.sSettingFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java index 2ac6fec6..f4e94df6 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -63,5 +63,11 @@ public class strings /*Message Manager*/ public static final String MESSAGE_PLAYSTORE_NOT_FOUND = "Playstore Not Found"; + + /*Bookmark Setting Manager*/ + + public static final String BOOKMARK_SETTING_VALIDATION_ERROR_1 = "➔ bookmark name empty"; + public static final String BOOKMARK_SETTING_VALIDATION_ERROR_2 = "➔ bookmark url empty"; + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java index 711d5b7c..d57a6b8b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java @@ -68,6 +68,22 @@ public class bookmarkDataModel { mBookmarks.clear(); } + void updateBookmark(String pBookmarkName, String pBookmarkURL, int pBookmarkID){ + for(int mCounter=0;mCounter pData){ - if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){ + public Object onTrigger(dataEnums.eBookmarkCommands pCommands, List pData){ + if(pCommands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){ return getBookmark(); } - else if(p_commands == dataEnums.eBookmarkCommands.M_ADD_BOOKMARK){ + else if(pCommands == dataEnums.eBookmarkCommands.M_ADD_BOOKMARK){ addBookmark((String)pData.get(0), (String)pData.get(1)); } - else if(p_commands == dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK){ + else if(pCommands == dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK){ deleteBookmark((int)pData.get(0)); } - else if(p_commands == dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK){ + else if(pCommands == dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK){ clearBookmark(); } + else if(pCommands == dataEnums.eBookmarkCommands.M_UPDATE_BOOKMARK){ + updateBookmark((String) pData.get(0),(String) pData.get(1),(int) pData.get(2)); + } return null; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java index c2036e6a..6b5379df 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java @@ -213,7 +213,7 @@ public class dataController dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java index 54c26985..89a10f66 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java @@ -13,7 +13,7 @@ public class dataEnums } public enum eBookmarkCommands { - M_ADD_BOOKMARK, M_GET_BOOKMARK, M_DELETE_BOOKMARK, M_CLEAR_BOOKMARK; + M_ADD_BOOKMARK, M_GET_BOOKMARK, M_DELETE_BOOKMARK, M_CLEAR_BOOKMARK, M_UPDATE_BOOKMARK; } public enum eReferenceWebsiteCommands { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java index ce40745f..485351e7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java @@ -9,6 +9,10 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod; import org.mozilla.geckoview.GeckoSession; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.Deflater; + public class tabRowModel { /*Private Variables*/ @@ -30,11 +34,39 @@ public class tabRowModel this.mId = pID; this.mDate = pDate; if(pBlob!=null){ - mBitmap = BitmapFactory.decodeByteArray(pBlob,0,pBlob.length); + if(mBitmap!=null && !mBitmap.isRecycled()){ + mBitmap.recycle(); + mBitmap = null; + } + try { + byte[] pBlobTemp = compress(pBlob); + int mSize = pBlobTemp.length; + mBitmap = BitmapFactory.decodeByteArray(pBlobTemp,0,mSize); + } catch (IOException e) { + e.printStackTrace(); + } } } - /*Helper Method*/ + public byte[] compress(byte[] data) throws IOException { + Deflater deflater = new Deflater(); + deflater.setInput(data); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length); + + deflater.finish(); + byte[] buffer = new byte[1024]; + while (!deflater.finished()) { + int count = deflater.deflate(buffer); // returns the generated code... index + outputStream.write(buffer, 0, count); + } + outputStream.close(); + byte[] output = outputStream.toByteArray(); + + return output; + } + + /*Helper Method*/ public geckoSession getSession() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java index 7cdfd8e5..8e541c7a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java @@ -96,13 +96,25 @@ public class sqlCipherDataModel }; private void execSQL(String query,Object params,boolean pContentValues) + { + if(params==null) + { + sDatabaseInstance.execSQL(query); + } + else + { + sDatabaseInstance.execSQL(query,(String[])params); + } + } + + private void execSQL(String query,Object params,boolean pContentValues,String whereClause, String[] whereArgs) { if(params==null) { sDatabaseInstance.execSQL(query); } else if(pContentValues){ - sDatabaseInstance.replace(query,null,(ContentValues)params); + sDatabaseInstance.update(query, (ContentValues)params, whereClause, whereArgs); } else { @@ -209,7 +221,7 @@ public class sqlCipherDataModel execSQL((String)pData.get(0), pData.get(1), false); } else if(pCommands == dataEnums.eSqlCipherCommands.M_EXEC_SQL_USING_CONTENT){ - execSQL((String)pData.get(0), pData.get(1), true); + execSQL((String)pData.get(0), pData.get(1), true, (String)pData.get(3), (String[])pData.get(4)); } else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK){ return selectBookmark(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java index c72051e1..f43a4eaa 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -38,6 +38,7 @@ class tabDataModel private ArrayList mTabs = new ArrayList<>(); void initializeTab(ArrayList pTabMdel){ + mTabs.clear(); mTabs.addAll(pTabMdel); } @@ -79,7 +80,9 @@ class tabDataModel return enums.AddTabCallback.TAB_ADDED; } - mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + if(mTabModel.getmId()!=null){ + //mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + } } return enums.AddTabCallback.TAB_ADDED; } @@ -195,7 +198,9 @@ class tabDataModel return false; } - mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + if(mTabs.get(counter).getmId()!=null){ + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + } return true; } } @@ -260,7 +265,7 @@ class tabDataModel byte[] mThumbnail = out.toByteArray(); ContentValues mContentValues = new ContentValues(); mContentValues.put("mThumbnail", mThumbnail); - mExternalEvents.invokeObserver(Arrays.asList("tab",mContentValues, mTabs.get(finalCounter).getmId()), dataEnums.eTabCallbackCommands.M_EXEC_SQL_USING_CONTENT); + mExternalEvents.invokeObserver(Arrays.asList("tab",mContentValues, "mid = ?", new String[]{mTabs.get(finalCounter).getmId()}), dataEnums.eTabCallbackCommands.M_EXEC_SQL_USING_CONTENT); } } } diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java index 6b5b28d6..840f21bb 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java @@ -4,8 +4,6 @@ import android.appwidget.AppWidgetProvider; import android.content.Context; import android.view.View; import android.widget.RemoteViews; - -import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeEnums; import com.darkweb.genesissearchengine.eventObserver; import com.example.myapplication.R; diff --git a/app/src/main/res/anim/fade_out_lang.xml b/app/src/main/res/anim/fade_out_lang.xml index f4421c36..a713e33e 100644 --- a/app/src/main/res/anim/fade_out_lang.xml +++ b/app/src/main/res/anim/fade_out_lang.xml @@ -1,4 +1,5 @@ - + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_edit.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_edit.xml new file mode 100644 index 00000000..5348afab --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_edit.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layouts/bookmark/layout/bookmark_row_view.xml b/app/src/main/res/layouts/bookmark/layout/bookmark_row_view.xml new file mode 100644 index 00000000..a638f231 --- /dev/null +++ b/app/src/main/res/layouts/bookmark/layout/bookmark_row_view.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml b/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml new file mode 100644 index 00000000..d7105f25 --- /dev/null +++ b/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml b/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml index 9c3aa319..fab6e8a7 100644 --- a/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml +++ b/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController"> + tools:context="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkController"> #2c2b31 #2c2b31 #3c3946 + #660b0b #24222a #00000000 #00000000 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 230e2ab6..f0893ce3 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -40,7 +40,7 @@ #3385ff #3385ff #f9f9f9 - #808080 + #f7f7f7 #f5fff5 #e0ffe0 #e3e3e3 @@ -59,6 +59,7 @@ #000000 #ffffff #f1f3f4 + #f9e2eb #f5f5f5 #f65555 #b3b3b3 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 539dc346..7c2bea87 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -326,6 +326,15 @@ We want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose. We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security\n\n This Service only contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services. We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page. + + Edit Bookmark + Bookmark URL + Bookmark Name + enter bookmark name + enter bookmark url + ➔ invalid bookmark name + ➔ invalid bookmark url + Security Settings Bridge Settings diff --git a/app/variables.gradle b/app/variables.gradle index 70974b11..2a55fa95 100755 --- a/app/variables.gradle +++ b/app/variables.gradle @@ -1,6 +1,6 @@ /* Version */ -project.ext.vname = 'Build | Dark-Origin 1.4.1' -project.ext.vcode = 70 +project.ext.vname = 'Build | Dark-Origin 1.4.2' +project.ext.vcode = 75 project.ext.buildType = 'release' /* dimension */ diff --git a/build.gradle b/build.gradle index 0a41953d..6f7a38d7 100755 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,8 @@ buildscript { + ext { + kotlin_version = '1.5.10' + } ext.kotlinVersion = '1.1.51' repositories { google()