Verified Commit aaa421af authored by Sarath's avatar Sarath
Browse files

Androidx migration

parent c1cf381b
......@@ -16,9 +16,10 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.text.InputType;
import android.util.Log;
import android.view.KeyEvent;
......
......@@ -5,7 +5,7 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
import android.view.MotionEvent;
......
......@@ -7,6 +7,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import com.invertedx.torservice.TorProxyManager;
import com.samourai.sentinel.tor.TorManager;
import com.samourai.sentinel.util.AppUtil;
import com.samourai.sentinel.util.ConnectivityStatus;
......@@ -44,11 +45,11 @@ public class MainActivity extends Activity {
if (ConnectivityStatus.hasConnectivity(getApplicationContext()) && PrefsUtil.getInstance(getApplicationContext()).getValue(PrefsUtil.ENABLE_TOR, false)) {
loaderTxView.setText(getText(R.string.initializing_tor));
Disposable disposable = TorManager.getInstance(getApplicationContext())
.torStatus
.getTorStatus()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(connection_states -> {
if (connection_states == TorManager.CONNECTION_STATES.CONNECTED) {
if (connection_states == TorProxyManager.ConnectionStatus.CONNECTED) {
doMain();
compositeDisposables.dispose();
}
......
......@@ -9,12 +9,11 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.LocalBroadcastManager;
import android.view.KeyEvent;
import android.widget.Toast;
//import android.util.Log;
import com.samourai.sentinel.access.AccessFactory;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.samourai.sentinel.api.APIFactory;
import com.samourai.sentinel.service.BackgroundManager;
import com.samourai.sentinel.service.WebSocketService;
......
......@@ -14,11 +14,11 @@ import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.FileProvider;
import android.support.v4.content.LocalBroadcastManager;
import androidx.core.content.FileProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
......
package com.samourai.sentinel;
import android.app.Application;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.multidex.MultiDex;
import androidx.multidex.MultiDex;
import com.samourai.sentinel.tor.TorService;
import com.samourai.sentinel.util.ConnectivityStatus;
......
......@@ -10,7 +10,7 @@ import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
......
......@@ -7,7 +7,7 @@ import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.util.Pair;
......
......@@ -9,12 +9,11 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.constraint.Group;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.app.DialogFragment;
import androidx.constraintlayout.widget.Group;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
......@@ -26,7 +25,7 @@ import android.widget.TextView;
import android.widget.Toast;
import com.samourai.sentinel.InsertSegwitActivity;
import com.invertedx.torservice.TorProxyManager;
import com.samourai.sentinel.R;
import com.samourai.sentinel.SamouraiSentinel;
import com.samourai.sentinel.codescanner.CameraFragmentBottomSheet;
......@@ -160,13 +159,13 @@ public class DojoConfigureBottomSheet extends BottomSheetDialogFragment {
startIntent.setAction(TorService.START_SERVICE);
getActivity().startService(startIntent);
Disposable disposable = TorManager.getInstance(getActivity().getApplicationContext())
.torStatus
.getTorStatus()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(state -> {
if (state == TorManager.CONNECTION_STATES.CONNECTING) {
if (state == TorProxyManager.ConnectionStatus.CONNECTING) {
progressStates.setText("Waiting for Tor...");
} else if (state == TorManager.CONNECTION_STATES.CONNECTED) {
} else if (state == TorProxyManager.ConnectionStatus.CONNECTED) {
PrefsUtil.getInstance(getActivity()).setValue(PrefsUtil.ENABLE_TOR, true);
dojoConnectProgress.setProgress(60);
progressStates.setText("Tor Connected, Connecting to Dojo Node...");
......
......@@ -2,9 +2,9 @@ package com.samourai.sentinel.network.dojo;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
......@@ -12,6 +12,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.invertedx.torservice.TorProxyManager;
import com.samourai.sentinel.R;
import com.samourai.sentinel.SamouraiSentinel;
import com.samourai.sentinel.service.WebSocketService;
......@@ -154,19 +155,19 @@ public class Network extends AppCompatActivity {
private void listenToTorStatus() {
Disposable disposable = TorManager.getInstance(getApplicationContext())
.torStatus
.getTorStatus()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::setTorConnectionState);
disposables.add(disposable);
this.runOnUiThread(() -> setTorConnectionState(TorManager.getInstance(getApplicationContext()).isConnected() ? TorManager.CONNECTION_STATES.CONNECTED : TorManager.CONNECTION_STATES.DISCONNECTED));
this.runOnUiThread(() -> setTorConnectionState(TorManager.getInstance(getApplicationContext()).isConnected() ? TorProxyManager.ConnectionStatus.CONNECTED : TorProxyManager.ConnectionStatus.DISCONNECTED));
}
private void setTorConnectionState(TorManager.CONNECTION_STATES enabled) {
private void setTorConnectionState(TorProxyManager.ConnectionStatus enabled) {
this.runOnUiThread(() -> {
if (enabled == TorManager.CONNECTION_STATES.CONNECTED) {
if (enabled == TorProxyManager.ConnectionStatus.CONNECTED) {
torButton.setText(getString(R.string.disable));
torButton.setEnabled(true);
torConnectionIcon.setColorFilter(activeColor);
......@@ -183,7 +184,7 @@ public class Network extends AppCompatActivity {
//
// }
} else if (enabled == TorManager.CONNECTION_STATES.CONNECTING) {
} else if (enabled == TorProxyManager.ConnectionStatus.CONNECTING) {
torRenewBtn.setVisibility(View.INVISIBLE);
torButton.setText(getString(R.string.loading));
torButton.setEnabled(false);
......
......@@ -6,8 +6,8 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.util.Log;
import com.samourai.sentinel.R;
......
......@@ -4,22 +4,21 @@ import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Looper;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
//import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.neovisionaries.ws.client.WebSocket;
import com.neovisionaries.ws.client.WebSocketAdapter;
import com.neovisionaries.ws.client.WebSocketException;
import com.neovisionaries.ws.client.WebSocketFactory;
import com.neovisionaries.ws.client.WebSocketFrame;
import com.samourai.sentinel.MainActivity2;
import com.samourai.sentinel.R;
import com.samourai.sentinel.SamouraiSentinel;
import com.samourai.sentinel.util.MonetaryUtil;
import com.samourai.sentinel.util.NotificationsFactory;
import com.samourai.sentinel.util.ReceiveLookAtUtil;
import org.json.JSONArray;
import org.json.JSONException;
......@@ -28,8 +27,6 @@ import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
public class WebSocketHandler {
......
package com.samourai.sentinel.util;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
public class GenericFileProvider extends FileProvider {
}
......@@ -6,8 +6,8 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
public class NotificationsFactory {
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
......@@ -8,12 +8,12 @@
android:fitsSystemWindows="true"
tools:context="com.samourai.sentinel.BalanceActivity">
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -29,7 +29,7 @@
android:layout_below="@+id/BalanceBar"
android:divider="@drawable/list_divider" />
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<net.i2p.android.ext.floatingactionbutton.FloatingActionsMenu
android:id="@+id/wallet_menu"
......@@ -83,10 +83,10 @@
</net.i2p.android.ext.floatingactionbutton.FloatingActionsMenu>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
......@@ -94,7 +94,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
......@@ -104,13 +104,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<!--<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -141,7 +141,7 @@
</LinearLayout>
<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -149,16 +149,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
......@@ -8,7 +8,7 @@
android:fitsSystemWindows="true"
tools:context="com.samourai.sentinel.XPUBListActivity">
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
......@@ -41,10 +41,10 @@
fab:fab_title="@string/watchlist" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
......@@ -52,16 +52,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -34,4 +34,4 @@
app:layout_constraintHorizontal_bias="0.49"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loader" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -7,7 +7,7 @@
android:fitsSystemWindows="true"
tools:context="com.samourai.sentinel.network.dojo.Network">
<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
......@@ -15,20 +15,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
......@@ -298,8 +298,8 @@
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
......@@ -8,7 +8,7 @@
>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
......@@ -132,7 +132,7 @@
app:layout_constraintTop_toBottomOf="@+id/textView43"
app:layout_constraintVertical_bias="0.0" />
<android.support.constraint.Group
<androidx.constraintlayout.widget.Group
android:id="@+id/dojo_btn_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -167,7 +167,7 @@
app:layout_constraintTop_toBottomOf="@+id/dojo_connect_progress"
app:layout_constraintVertical_bias="0.0" />
<android.support.constraint.Group
<androidx.constraintlayout.widget.Group
android:id="@+id/dojo_progress_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -175,6 +175,6 @@
app:constraint_referenced_ids="dojo_progress_status_text,dojo_connect_progress" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment