commit 7303a33311fe4cabcba70ab298a1cc8e782e0a9c Author: n8fr8 nathan@freitas.net Date: Fri Dec 8 11:56:11 2017 -0500
work on the new UI update --- app/build.gradle | 1 + app/src/fullperm/AndroidManifest.xml | 6 +- app/src/main/AndroidManifest.xml | 6 +- .../org/torproject/android/OrbotMainActivity.java | 16 ++- app/src/main/res/layout/layout_main.xml | 125 ++++++++++++++------- app/src/main/res/layout/layout_orbot_control.xml | 11 -- 6 files changed, 108 insertions(+), 57 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle index 12f5eace..b18ce78c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,4 +49,5 @@ dependencies { compile 'com.android.support:support-v4:25.3.1' compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:25.3.1' + compile 'pl.bclogic:pulsator4droid:1.0.3' } diff --git a/app/src/fullperm/AndroidManifest.xml b/app/src/fullperm/AndroidManifest.xml index 0c1b4185..a4d678c0 100644 --- a/app/src/fullperm/AndroidManifest.xml +++ b/app/src/fullperm/AndroidManifest.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" package="org.torproject.android" android:installLocation="auto">
@@ -25,8 +26,9 @@ android:hardwareAccelerated="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name" - android:largeHeap="false" - android:theme="@style/DefaultTheme"> + android:theme="@style/DefaultTheme" + tools:replace="android:allowBackup" + > <activity android:name=".OrbotMainActivity" android:excludeFromRecents="true" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 387b53f2..b72e4eae 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" package="org.torproject.android" android:installLocation="auto">
@@ -17,8 +18,9 @@ android:hardwareAccelerated="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name" - android:largeHeap="false" - android:theme="@style/DefaultTheme"> + android:theme="@style/DefaultTheme" + tools:replace="android:allowBackup" + > <activity android:name=".OrbotMainActivity" android:excludeFromRecents="true" diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index e53c8841..88637331 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -91,6 +91,8 @@ import android.widget.Toast; import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult;
+import pl.bclogic.pulsator4droid.library.PulsatorLayout; + import static android.support.v4.content.FileProvider.getUriForFile; import static org.torproject.android.binary.TorServiceConstants.BINARY_TOR_VERSION;
@@ -268,6 +270,7 @@ public class OrbotMainActivity extends AppCompatActivity R.string.btn_okay, R.string.btn_cancel );
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
@@ -431,8 +434,11 @@ public class OrbotMainActivity extends AppCompatActivity
((TextView)findViewById(R.id.torInfo)).setText("Tor v" + BINARY_TOR_VERSION);
+ mPulsator = (PulsatorLayout) findViewById(R.id.pulsator); + } - + + PulsatorLayout mPulsator; GestureDetector mGestureDetector;
@@ -1171,7 +1177,10 @@ public class OrbotMainActivity extends AppCompatActivity
requestTorStatus();
- updateStatus(null, torStatus); + if (torStatus == null) + updateStatus("", TorServiceConstants.STATUS_STOPPING); + else + updateStatus(null, torStatus);
if (Prefs.useTransparentProxying()) { @@ -1246,6 +1255,7 @@ public class OrbotMainActivity extends AppCompatActivity imgStatus.setImageResource(R.drawable.toron);
mBtnStart.setText(R.string.menu_stop); + mPulsator.stop();
lblStatus.setText(getString(R.string.status_activated));
@@ -1320,6 +1330,8 @@ public class OrbotMainActivity extends AppCompatActivity
mBtnStart.setText(R.string.menu_start);
+ mPulsator.start(); + }
diff --git a/app/src/main/res/layout/layout_main.xml b/app/src/main/res/layout/layout_main.xml index 20237bdf..a955fd0a 100644 --- a/app/src/main/res/layout/layout_main.xml +++ b/app/src/main/res/layout/layout_main.xml @@ -35,27 +35,102 @@ android:orientation="vertical" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:layout_marginTop="20dp" + android:layout_margin="3dp" + android:background="#11CCCCCC" android:weightSum="1"> + <pl.bclogic.pulsator4droid.library.PulsatorLayout + android:id="@+id/pulsator" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:pulse_count="4" + app:pulse_duration="2000" + app:pulse_repeat="0" + app:pulse_color="@color/dark_green" + app:pulse_startFromScratch="false" + app:pulse_interpolator="Linear"> <org.torproject.android.ui.ImageProgressView android:id="@+id/imgStatus" android:layout_width="match_parent" android:layout_height="225dp" android:padding="0dp" android:layout_margin="0dp" + android:layout_marginTop="20dp" android:src="@drawable/toroff" /> -<Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/btnStart" - android:text="@string/menu_start" - android:layout_gravity="center" - />
+ </pl.bclogic.pulsator4droid.library.PulsatorLayout> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/btnStart" + android:text="@string/menu_start" + android:layout_gravity="center" + android:background="@android:color/transparent" + /> </FrameLayout>
+<LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_below="@+id/frameMain" + android:id="@+id/controls" + + > + + <LinearLayout + android:id="@+id/spinnerBox" + android:layout_gravity="left" + android:orientation="vertical" + android:layout_width="170sp" + android:layout_height="100dp" + android:background="#11CCCCCC" + android:layout_margin="3dp" + android:layout_weight="1" + > + <Spinner + android:id="@+id/spinnerCountry" + android:layout_width="140dp" + android:layout_height="wrap_content" + android:layout_margin="12dp" + /> + + </LinearLayout>
+ <LinearLayout + android:id="@+id/row_vpn" + android:layout_gravity="right" + android:orientation="vertical" + android:layout_width="170sp" + android:layout_height="100dp" + android:background="#11CCCCCC" + android:layout_margin="3dp" + android:layout_weight="1" + + > + <android.support.v7.widget.SwitchCompat + android:id="@+id/btnVPN" + android:layout_width="140dp" + android:layout_height="wrap_content" + android:text="@string/apps_mode" + android:layout_margin="12dp" + android:layout_gravity="center" + app:switchPadding="9dp" + + /> + <Button + android:id="@+id/btnApps" + android:layout_width="wrap_content" + android:layout_height="40dp" + android:text="@string/menu_apps" + android:ellipsize="end" + android:maxLines="1" + android:layout_gravity="center" + + /> + </LinearLayout> + +</LinearLayout> <TextView android:id="@+id/lblStatus" android:layout_width="match_parent" @@ -63,47 +138,17 @@ android:textSize="14sp" android:fontFamily="sans-serif-light" android:lines="1" - android:text="---" + android:text="[ ]" android:maxLines="1" android:layout_margin="12dp" android:ellipsize="end" android:layout_gravity="top|center" android:gravity="center" - android:layout_below="@+id/frameMain" + android:layout_below="@+id/controls" />
- <LinearLayout - android:id="@+id/row_vpn" - android:gravity="center_horizontal|bottom" - android:layout_gravity="bottom" - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - > - <android.support.v7.widget.SwitchCompat - android:id="@+id/btnVPN" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/apps_mode" - android:layout_margin="12dp" - android:layout_gravity="center" - app:switchPadding="9dp" - - /> - <Button - android:id="@+id/btnApps" - android:layout_width="wrap_content" - android:layout_height="40dp" - android:text="@string/menu_apps" - android:ellipsize="end" - android:maxLines="1" - android:layout_gravity="center" - - /> - </LinearLayout>
</RelativeLayout> diff --git a/app/src/main/res/layout/layout_orbot_control.xml b/app/src/main/res/layout/layout_orbot_control.xml index 4df63591..0e40e49c 100644 --- a/app/src/main/res/layout/layout_orbot_control.xml +++ b/app/src/main/res/layout/layout_orbot_control.xml @@ -23,17 +23,6 @@ />
- <Spinner - android:id="@+id/spinnerCountry" - android:layout_width="220dp" - android:layout_height="wrap_content" - android:layout_margin="12dp" - android:layout_marginLeft="9dp" - /> - - - - <RelativeLayout android:id="@+id/rowTrafficDown" android:layout_width="match_parent"