Bug Fixes

Bug Fixes
master
msmannan00 2021-05-15 23:56:17 +05:00
parent 1c5282f031
commit 2d40f80bc1
21 changed files with 286 additions and 227 deletions

Binary file not shown.

View File

@ -101,7 +101,7 @@
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity <activity
android:name="com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController" android:name="com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController"
android:configChanges="uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity <activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController" android:name="com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController"
@ -145,10 +145,10 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.darkweb.genesissearchengine.externalNavigationManager.externalShortcuts" <activity android:name="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts"
android:launchMode="singleTop"/> android:launchMode="singleTop"/>
<activity android:name="com.darkweb.genesissearchengine.externalNavigationManager.externalNavigationController" <activity android:name="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalNavigationController"
android:launchMode="singleTask" android:launchMode="singleTask"
> >
<intent-filter> <intent-filter>

View File

@ -0,0 +1,77 @@
package com.darkweb.genesissearchengine.appManager.externalNavigationManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class externalNavigationController extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri data = externalNavigationController.this.getIntent().getData();
if(data == null || status.sSettingIsAppStarted){
/* Close Activity */
finish();
activityContextManager.getInstance().onClearStack();
/* Create Request Handler */
if(status.sSettingIsAppStarted && data!=null){
helperMethod.onDelayHandler(this, 3000, () -> {
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString()));
activityContextManager.getInstance().getHomeController().onClearSelectionTab();
return null;
});
}
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
}
else if(status.sSettingIsAppRunning){
/* Refresh Intent Data */
finish();
status.sExternalWebsite = data.toString();
}else {
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if(activityContextManager.getInstance().getHomeController()!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
}else {
status.sExternalWebsite = data.toString();
}
this.startActivity(intent);
this.overridePendingTransition(0, 0);
/* Bring Application To Front */
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent);
/* Close Activity */
helperMethod.onDelayHandler(this, 1000, () -> {
finish();
return null;
});
}
}
}

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.externalNavigationManager; package com.darkweb.genesissearchengine.appManager.externalNavigationManager;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@ -16,6 +16,7 @@ import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;
@ -58,66 +59,15 @@ public class externalShortcuts extends AppCompatActivity {
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
Uri data = this.getIntent().getData(); /* Start Required Activity */
if(data == null){
finish();
activityContextManager.getInstance().onClearStack();
Intent bringToForegroundIntent = new Intent(externalShortcuts.this, homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
return;
}
if(status.sSettingIsAppStarted){
finish();
activityContextManager.getInstance().onClearStack();
new Handler().postDelayed(() ->
{
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString()));
activityContextManager.getInstance().getHomeController().onClearSelectionTab();
}, 500);
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
return;
}else if(status.sSettingIsAppRunning){
finish();
status.sExternalWebsite = data.toString();
return;
}
Intent intent = new Intent(this.getIntent()); Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName()); intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if(activityContextManager.getInstance().getHomeController()!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
}else {
status.sExternalWebsite = data.toString();
}
this.startActivity(intent); this.startActivity(intent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
new Thread(){
public void run(){
try {
sleep(1000);
externalShortcuts.this.runOnUiThread(() -> finish());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
}, 800); }, 800);
} }

View File

@ -71,7 +71,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter<orbotLogAdapter.listVi
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + mHeader.getText())); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + mModelList.get(this.getLayoutPosition()).getLog()));
intent.putExtra(SearchManager.QUERY, mDescription.getText()); intent.putExtra(SearchManager.QUERY, mDescription.getText());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activityContextManager.getInstance().getHomeController().startActivity(intent); activityContextManager.getInstance().getHomeController().startActivity(intent);

View File

@ -12,12 +12,12 @@ import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView; import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController; import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
@ -26,12 +26,18 @@ import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.torproject.android.service.wrapper.logRowModel;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_THEME_UPDATE; import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE;
public class orbotLogController extends AppCompatActivity { public class orbotLogController extends AppCompatActivity {
@ -42,7 +48,7 @@ public class orbotLogController extends AppCompatActivity {
private orbotLogViewController mOrbotLogViewController; private orbotLogViewController mOrbotLogViewController;
private orbotLogAdapter mOrbotAdapter; private orbotLogAdapter mOrbotAdapter;
private boolean mActivityClosed = false; private boolean mActivityClosed = false;
private int mLogCounter = 0; private int mLogCounter = 1;
private boolean mIsRecycleviewInteracting = false; private boolean mIsRecycleviewInteracting = false;
/* UI VARIABLES */ /* UI VARIABLES */
@ -79,10 +85,27 @@ public class orbotLogController extends AppCompatActivity {
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
mNestedScrollView.stopNestedScroll();
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
onScrollBottom();
}
}else {
mNestedScrollView.scrollTo(0,0);
}
orbotLogStatus.sScrollPosition = -1;
}
return null;
});
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
} }
public void initializeViews() {
private void initializeViews() {
mLogRecycleView = findViewById(R.id.pLogRecycleView); mLogRecycleView = findViewById(R.id.pLogRecycleView);
mLogs = findViewById(R.id.pLogs); mLogs = findViewById(R.id.pLogs);
mNestedScrollView = findViewById(R.id.pNestedScrollView); mNestedScrollView = findViewById(R.id.pNestedScrollView);
@ -92,13 +115,13 @@ public class orbotLogController extends AppCompatActivity {
mOrbotModel = new orbotLogModel(); mOrbotModel = new orbotLogModel();
} }
public void initializeLogs(){ private void initializeLogs(){
mLogCounter = 0; mLogCounter = 0;
if(status.sLogThemeStyleAdvanced){
mLogCounter = orbotLocalConstants.mTorLogsHistory.size();
mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory); mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory);
if(status.sLogThemeStyleAdvanced){
mLogCounter = (int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);
LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this); LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this);
orbotLogAdapter adapter = new orbotLogAdapter(mOrbotModel.getList(),new orbotLogController.orbotModelCallback()); orbotLogAdapter adapter = new orbotLogAdapter(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)),new orbotLogController.orbotModelCallback());
mOrbotAdapter = adapter; mOrbotAdapter = adapter;
layoutManager.setReverseLayout(true); layoutManager.setReverseLayout(true);
@ -114,12 +137,13 @@ public class orbotLogController extends AppCompatActivity {
logToString(); logToString();
} }
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced)); mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced));
mLogRecycleView.smoothScrollToPosition(mOrbotModel.getList().size()); mLogRecycleView.smoothScrollToPosition((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE));
} }
/* LISTENERS */ /* LISTENERS */
@RequiresApi(api = Build.VERSION_CODES.M)
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void initListener(){ private void initListener(){
@ -127,29 +151,27 @@ public class orbotLogController extends AppCompatActivity {
@SuppressLint("NewApi") @SuppressWarnings("deprecation") @SuppressLint("NewApi") @SuppressWarnings("deprecation")
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
if(orbotLogStatus.sScrollPosition!=-1){ if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
}else if(mNestedScrollView.canScrollVertically(1)){ }else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
onScrollBottom(null); onScrollBottom();
} }
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> orbotLogStatus.sScrollPosition = scrollY);
orbotLogStatus.sScrollPosition = scrollY;
});
} }
mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE); mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this); mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} }
}); });
mNestedScrollView.setOnTouchListener((v, event) -> { mNestedScrollView.setOnTouchListener((v, event) -> {
if(mNestedScrollView.canScrollVertically(1)){ if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
orbotLogStatus.sUIInteracted = true; orbotLogStatus.sUIInteracted = true;
} }
if(event.getAction() == MotionEvent.ACTION_UP){ if(event.getAction() == MotionEvent.ACTION_UP){
mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE); mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
} }
if(event.getAction() == MotionEvent.ACTION_UP){ if(event.getAction() == MotionEvent.ACTION_UP){
@ -161,9 +183,23 @@ public class orbotLogController extends AppCompatActivity {
return false; return false;
}); });
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
});
mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> {
if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { if (mNestedScrollView.getScrollY() == 0)
mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE); {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
else if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
if(!mIsRecycleviewInteracting){ if(!mIsRecycleviewInteracting){
orbotLogStatus.sUIInteracted = false; orbotLogStatus.sUIInteracted = false;
@ -172,60 +208,73 @@ public class orbotLogController extends AppCompatActivity {
}); });
} }
public void logToString(){ private void logToString(){
for(int mCounter=0;mCounter<orbotLocalConstants.mTorLogsHistory.size();mCounter++){ if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mCounter).getLog())); for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).get(mCounter).getLog()));
mLogCounter+=1; mLogCounter+=1;
} }
} }
}
public void updateLogs(){ private void updateLogs(){
new Thread(){ new Thread(){
public void run(){ public void run(){
while (!mActivityClosed){
try { try {
sleep(1000);
while (!mActivityClosed){
if(status.sLogThemeStyleAdvanced){ if(status.sLogThemeStyleAdvanced){
sleep(800); sleep(800);
}else { }else {
sleep(100); sleep(100);
} }
if(orbotLocalConstants.mTorLogsHistory.size()>0){ if(mLogCounter>0){
runOnUiThread(() -> { runOnUiThread(() -> {
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){ if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
mOrbotModel.getList().add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)); ((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter));
if(!status.sLogThemeStyleAdvanced){ if(!status.sLogThemeStyleAdvanced){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mLogCounter).getLog())); mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).get(mLogCounter).getLog()));
}else { }else {
if(mOrbotAdapter!=null){ if(mOrbotAdapter!=null){
mOrbotAdapter.notifyItemInserted(mOrbotModel.getList().size()-1); mOrbotAdapter.notifyItemInserted((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)-1);
} }
} }
if(!orbotLogStatus.sUIInteracted){
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
if(!orbotLogStatus.sUIInteracted){
onScrollBottomAnimated(null);
}
return null;
});
}
mLogCounter+=1; mLogCounter+=1;
} }
}); });
} }
sleep(100);
if(!orbotLogStatus.sUIInteracted){
runOnUiThread(() -> {
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter) {
onScrollBottom(null);
} }
});
} }
} catch (InterruptedException e) { catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
}.start(); }.start();
} }
private void onScrollBottom() {
mNestedScrollView.scrollTo(0,helperMethod.pxFromDp((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)*100));
}
/* View Callback */ /* View Callback */
public void onScrollBottom(View view) { public void onScrollBottomAnimated(View view) {
mNestedScrollView.fullScroll(View.FOCUS_DOWN); mNestedScrollView.fullScroll(View.FOCUS_DOWN);
orbotLogStatus.sUIInteracted = false; orbotLogStatus.sUIInteracted = false;
if(view!=null){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
} }
public void onOpenInfo(View view) { public void onOpenInfo(View view) {
@ -287,8 +336,12 @@ public class orbotLogController extends AppCompatActivity {
/* External Calls */ /* External Calls */
public void onRefreshLayoutTheme(){ public void onRefreshLayoutTheme(){
if(!orbotLogStatus.sUIInteracted){
orbotLogStatus.sScrollPosition = -1;
}else {
orbotLogStatus.sScrollPosition = 0; orbotLogStatus.sScrollPosition = 0;
orbotLogStatus.sUIInteracted = false; }
mIsRecycleviewInteracting = false; mIsRecycleviewInteracting = false;
recreate(); recreate();
} }

View File

@ -5,11 +5,12 @@ public class orbotLogEnums
/*Orbot Log View Manager*/ /*Orbot Log View Manager*/
public enum eOrbotLogViewCommands { public enum eOrbotLogViewCommands {
M_UPDATE_LOGS, M_INIT_VIEWS, M_SCROLL_THEME_UPDATE M_UPDATE_LOGS, M_INIT_VIEWS, M_FLOAT_BUTTON_UPDATE
} }
/*Orbot Log Model Manager*/ /*Orbot Log Model Manager*/
public enum eOrbotLogModelCommands { public enum eOrbotLogModelCommands {
M_GET_LIST, M_GET_LIST_SIZE
} }
} }

View File

@ -4,6 +4,7 @@ import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import org.torproject.android.service.wrapper.logRowModel; import org.torproject.android.service.wrapper.logRowModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
class orbotLogModel class orbotLogModel
{ {
@ -24,8 +25,29 @@ class orbotLogModel
} }
} }
ArrayList<logRowModel> getList() private ArrayList<logRowModel> getList()
{ {
return mModelList; return mModelList;
} }
private int getListSize()
{
return mModelList.size();
}
/*Triggers*/
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
}
public Object onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands){
if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST)){
return getList();
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE)){
return getListSize();
}
return null;
}
} }

View File

@ -6,6 +6,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView; import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; import com.darkweb.genesissearchengine.helperManager.sharedUIMethod;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
@ -56,19 +57,17 @@ class orbotLogViewController
private void onUpdateLogs(String pLogs){ private void onUpdateLogs(String pLogs){
pLogs = "~ " + pLogs; pLogs = "~ " + pLogs;
mLogs.setText(String.format("%s%s",mLogs.getText() ,pLogs + "\n\n")); mLogs.setText(String.format("%s%s",mLogs.getText() , "\n\n" + pLogs ));
} }
private void onScrollThemeUpdate(){ private void onFloatButtonUpdate(){
if(mNestedScrollView.canScrollVertically(1)){ if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
if(mFloatingScroller.getAlpha()==0){
mFloatingScroller.setVisibility(View.VISIBLE); mFloatingScroller.setVisibility(View.VISIBLE);
mFloatingScroller.animate().cancel(); mFloatingScroller.animate().cancel();
mFloatingScroller.animate().alpha(1); mFloatingScroller.animate().setDuration(250).alpha(1);
}
}else { }else {
mFloatingScroller.animate().cancel(); mFloatingScroller.animate().cancel();
mFloatingScroller.animate().alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE)); mFloatingScroller.animate().setDuration(250).alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE));
} }
} }
@ -82,8 +81,8 @@ class orbotLogViewController
else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){ else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){
initViews((boolean)pData.get(0)); initViews((boolean)pData.get(0));
} }
else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_THEME_UPDATE)){ else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE)){
onScrollThemeUpdate(); onFloatButtonUpdate();
} }
} }

View File

@ -14,7 +14,7 @@ public class constants
public static final String CONST_PRIVACY_POLICY_URL = "https://genesishiddentechnologies.com/privacy"; public static final String CONST_PRIVACY_POLICY_URL = "https://genesishiddentechnologies.com/privacy";
public static final String CONST_REPORT_URL = "https://genesishiddentechnologies.com/reportus?url="; public static final String CONST_REPORT_URL = "https://genesishiddentechnologies.com/reportus?url=";
public static final String CONST_SITEMAP = "https://genesishiddentechnologies.com/create"; public static final String CONST_SITEMAP = "https://genesishiddentechnologies.com/create";
public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine"; public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.dev";
/*DRIVE URL DEV*/ /*DRIVE URL DEV*/
@ -47,7 +47,7 @@ public class constants
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com?q=$s&ia=web"; public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com?q=$s&ia=web";
public static final String CONST_BACKEND_BING_URL = "https://bing.com/search?q=$s"; public static final String CONST_BACKEND_BING_URL = "https://bing.com/search?q=$s";
public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s"; public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s";
public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor logs"; public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor ";
/*PROXY CONSTANTS*/ /*PROXY CONSTANTS*/

View File

@ -35,4 +35,10 @@ public class enums
public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1; public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1;
public static final int M_IMAGE_LOADING_FAILED = 2; public static final int M_IMAGE_LOADING_FAILED = 2;
} }
public static class ScrollDirection {
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
}
} }

View File

@ -1,90 +0,0 @@
package com.darkweb.genesissearchengine.externalNavigationManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class externalNavigationController extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri data = externalNavigationController.this.getIntent().getData();
if(data == null){
finish();
activityContextManager.getInstance().onClearStack();
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
return;
}
if(status.sSettingIsAppStarted){
finish();
activityContextManager.getInstance().onClearStack();
new Handler(Looper.getMainLooper()).postDelayed(() -> {
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString()));
activityContextManager.getInstance().getHomeController().onClearSelectionTab();
}, 3000);
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
return;
}else if(status.sSettingIsAppRunning){
finish();
status.sExternalWebsite = data.toString();
return;
}
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if(activityContextManager.getInstance().getHomeController()!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
}else {
status.sExternalWebsite = data.toString();
}
this.startActivity(intent);
this.overridePendingTransition(0, 0);
new Thread(){
public void run(){
try {
sleep(1000);
externalNavigationController.this.runOnUiThread(() -> finish());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent);
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Uri data = intent.getData();
if(data!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent);
}
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size android:width="10dp" android:height="10dp"/>
<padding android:bottom="4dp" android:top="4dp"
android:left="4dp" android:right="4dp"/>
</shape>
</item>
<item android:drawable="@xml/ic_baseline_shortcut_erase">
</item>
</layer-list>

View File

@ -4,39 +4,39 @@
<shortcut <shortcut
android:shortcutId="Restart" android:shortcutId="Restart"
android:enabled="true" android:enabled="true"
android:icon="@xml/ic_baseline_shortcut_erase" android:icon="@xml/ic_baseline_shortcut_erase_back"
android:shortcutShortLabel="@string/shortcut_open" android:shortcutShortLabel="@string/shortcut_open"
android:shortcutLongLabel="@string/shortcut_open_long"> android:shortcutLongLabel="@string/shortcut_open_long">
<intent <intent
android:action="erase" android:action="erase"
android:targetPackage="com.darkweb.genesissearchengine" android:targetPackage="com.darkweb.genesissearchengine.dev"
android:targetClass="com.darkweb.genesissearchengine.externalNavigationManager.externalShortcuts"> android:targetClass="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts">
<extra android:name="shortcut" android:value="open" /> <extra android:name="shortcut" android:value="open" />
</intent> </intent>
</shortcut> </shortcut>
<shortcut <shortcut
android:shortcutId="erase_and_open" android:shortcutId="erase_and_open"
android:enabled="true" android:enabled="true"
android:icon="@xml/ic_baseline_shortcut_add_new" android:icon="@xml/ic_baseline_shortcut_add_new_back"
android:shortcutShortLabel="@string/shortcut_erase_and_open_short_label" android:shortcutShortLabel="@string/shortcut_erase_and_open_short_label"
android:shortcutLongLabel="@string/shortcut_erase_and_open_long_label"> android:shortcutLongLabel="@string/shortcut_erase_and_open_long_label">
<intent <intent
android:action="erase" android:action="erase"
android:targetPackage="com.darkweb.genesissearchengine" android:targetPackage="com.darkweb.genesissearchengine.dev"
android:targetClass="com.darkweb.genesissearchengine.externalNavigationManager.externalShortcuts"> android:targetClass="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts">
<extra android:name="shortcut" android:value="erase_and_open" /> <extra android:name="shortcut" android:value="erase_and_open" />
</intent> </intent>
</shortcut> </shortcut>
<shortcut <shortcut
android:shortcutId="erase" android:shortcutId="erase"
android:enabled="true" android:enabled="true"
android:icon="@xml/ic_baseline_shortcut_cross" android:icon="@xml/ic_baseline_shortcut_cross_back"
android:shortcutShortLabel="@string/shortcut_erase_short_label" android:shortcutShortLabel="@string/shortcut_erase_short_label"
android:shortcutLongLabel="@string/shortcut_erase_long_label"> android:shortcutLongLabel="@string/shortcut_erase_long_label">
<intent <intent
android:action="erase" android:action="erase"
android:targetPackage="com.darkweb.genesissearchengine" android:targetPackage="com.darkweb.genesissearchengine.dev"
android:targetClass="com.darkweb.genesissearchengine.externalNavigationManager.externalShortcuts"> android:targetClass="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts">
<extra android:name="shortcut" android:value="erase" /> <extra android:name="shortcut" android:value="erase" />
</intent> </intent>
</shortcut> </shortcut>

View File

@ -1,5 +1,6 @@
<vector android:height="24dp" android:tint="#3C5C7E" <vector android:height="48dp" android:tint="#3C5C7E"
android:viewportHeight="24" android:viewportWidth="24" android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/> <path android:fillColor="@android:color/white" android:pathData="M12,5V2L8,6l4,4V7c3.31,0 6,2.69 6,6c0,2.97 -2.17,5.43 -5,5.91v2.02c3.95,-0.49 7,-3.85 7,-7.93C20,8.58 16.42,5 12,5z"/>
<path android:fillColor="@android:color/white" android:pathData="M6,13c0,-1.65 0.67,-3.15 1.76,-4.24L6.34,7.34C4.9,8.79 4,10.79 4,13c0,4.08 3.05,7.44 7,7.93v-2.02C8.17,18.43 6,15.97 6,13z"/>
</vector> </vector>

View File

@ -82,9 +82,9 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@xml/ax_ripple_default_round_bottom" android:background="@xml/ax_ripple_default_round_bottom"
android:padding="0dp" android:padding="0dp"
android:textAlignment="textStart" android:paddingStart="38dp"
android:paddingStart="28.5dp"
android:text="@string/ALERT_DATA_CLEARED_BUTTON" android:text="@string/ALERT_DATA_CLEARED_BUTTON"
android:textAlignment="textStart"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/holo_gray" android:textColor="@color/holo_gray"
android:textSize="14sp" android:textSize="14sp"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size android:width="10dp" android:height="10dp"/>
<padding android:bottom="4dp" android:top="4dp"
android:left="4dp" android:right="4dp"/>
</shape>
</item>
<item android:drawable="@xml/ic_baseline_shortcut_add_new">
</item>
</layer-list>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size android:width="10dp" android:height="10dp"/>
<padding android:bottom="4dp" android:top="4dp"
android:left="4dp" android:right="4dp"/>
</shape>
</item>
<item android:drawable="@xml/ic_baseline_shortcut_cross">
</item>
</layer-list>

View File

@ -126,14 +126,13 @@
android:id="@+id/pLogs" android:id="@+id/pLogs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:background="@xml/sx_border_left" android:background="@xml/sx_border_left"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingEnd="10dp" android:paddingEnd="15dp"
android:paddingTop="25dp" android:paddingTop="20dp"
android:paddingBottom="5dp" android:paddingBottom="20dp"
android:layout_marginBottom="190dp" android:layout_marginBottom="150dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:textColor="@color/c_text_v4" android:textColor="@color/c_text_v4"
android:textSize="14sp" android:textSize="14sp"
@ -160,7 +159,7 @@
android:visibility="gone" android:visibility="gone"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:onClick="onScrollBottom" android:onClick="onScrollBottomAnimated"
android:clickable="true" android:clickable="true"
android:tint="@color/white" android:tint="@color/white"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@ -23,7 +23,7 @@
<string name="shortcut_erase_long_label">Erase browsing history</string> <string name="shortcut_erase_long_label">Erase browsing history</string>
<string name="shortcut_erase_and_open_short_label">Erase &amp; open</string> <string name="shortcut_erase_and_open_short_label">Erase &amp; open</string>
<string name="shortcut_erase_and_open_long_label">Erase and open</string> <string name="shortcut_erase_and_open_long_label">Erase and open</string>
<string name="shortcut_open">Restart</string> <string name="shortcut_open">Restart or Open</string>
<string name="shortcut_open_long">Restart Application</string> <string name="shortcut_open_long">Restart Application</string>
<!-- Temp --> <!-- Temp -->

View File

@ -7,4 +7,9 @@ settingLogModel
settingLogViewController settingLogViewController
/* In Progress */ /* In Progress */
OrbotLogs orbotLogAdapter
orbotLogController
orbotLogEnums
orbotLogModel
orbotLogStatus
orbotLogViewController