Skip to content

Commit

Permalink
Update overview activity to have a collapsable toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed Oct 30, 2023
1 parent 6fd4edf commit d532158
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public static Intent newIntent(Context context, AbstractSuite testSuite) {
"\n\n* [Tor Snowflake](https://ooni.org/nettest/tor-snowflake/) "+ String.format(" ( %s )",getString(R.string.Settings_TestOptions_LongRunningTest))+
"\n\n* [Vanilla Tor](https://github.com/ooni/spec/blob/master/nettests/ts-016-vanilla-tor.md) " + String.format(" ( %s )",getString(R.string.Settings_TestOptions_LongRunningTest));
markwon.setMarkdown(binding.desc, getString(testSuite.getDesc1(), experimentalLinks));
if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL)
binding.desc.setTextDirection(View.TEXT_DIRECTION_RTL);
if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL) {
binding.desc.setTextDirection(View.TEXT_DIRECTION_RTL);
}
}
else
markwon.setMarkdown(binding.desc, getString(testSuite.getDesc1()));
else {
markwon.setMarkdown(binding.desc, getString(testSuite.getDesc1()));
}
Result lastResult = Result.getLastResult(testSuite.getName());
if (lastResult == null)
binding.lastTime.setText(R.string.Dashboard_Overview_LastRun_Never);
Expand Down
181 changes: 96 additions & 85 deletions app/src/main/res/layout/activity_overview.xml
Original file line number Diff line number Diff line change
@@ -1,114 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
tools:context=".activity.OverviewActivity">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="16dp"
android:transitionName="@string/transitionNameCard"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:transitionName="@string/transitionNameTitle" />

<ImageView
android:id="@+id/icon"
android:layout_width="96dp"
android:layout_height="96dp"
android:tint="@android:color/white"
android:transitionName="@string/transitionNameIcon" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="horizontal"
android:transitionName="@string/transitionNameRuntime">
app:contentScrim="?attr/colorPrimary"
app:titleEnabled="false"
app:layout_scrollFlags="scroll|snap|exitUntilCollapsed">

<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical"
android:gravity="center_horizontal"
android:paddingBottom="16dp"
app:layout_collapseMode="parallax">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Dashboard_Overview_Estimated"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/icon"
android:layout_width="96dp"
android:layout_height="96dp"
app:tint="@android:color/white"
android:transitionName="@string/transitionNameIcon"/>

<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Dashboard_Overview_LatestTest"
android:textColor="@android:color/white" />
</LinearLayout>
android:layout_margin="8dp"
android:orientation="horizontal"
android:transitionName="@string/transitionNameRuntime">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/runtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@android:color/white"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Dashboard_Overview_Estimated"
android:textColor="@android:color/white"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Dashboard_Overview_LatestTest"
android:textColor="@android:color/white"/>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical">

<TextView
android:id="@+id/runtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@android:color/white"
android:textStyle="bold"/>

<TextView
android:id="@+id/lastTime"
<TextView
android:id="@+id/lastTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>

<Button
android:id="@+id/customUrl"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Dashboard_Overview_ChooseWebsites"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:textStyle="bold" />
app:cornerRadius="24dp"
app:rippleColor="@color/ripple_material_dark"
app:strokeColor="@android:color/white"/>
</LinearLayout>
</LinearLayout>

<Button
android:id="@+id/customUrl"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Dashboard_Overview_ChooseWebsites"
android:textAllCaps="false"
android:textColor="@android:color/white"
app:cornerRadius="24dp"
app:rippleColor="@color/ripple_material_dark"
app:strokeColor="@android:color/white" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/progress_fragment">

<TextView
android:id="@+id/desc"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="32dp" />
</ScrollView>
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"/>

<fragment
android:name="org.openobservatory.ooniprobe.fragment.ProgressFragment"
android:id="@+id/progress_fragment"
android:layout_alignParentBottom="true"
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:padding="32dp" />
</androidx.core.widget.NestedScrollView>

</RelativeLayout>
</LinearLayout>
<androidx.fragment.app.FragmentContainerView
android:name="org.openobservatory.ooniprobe.fragment.ProgressFragment"
android:id="@+id/progress_fragment"
app:layout_anchorGravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_result_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:titleEnabled="false">
app:titleEnabled="false"
app:layout_scrollFlags="scroll|snap|exitUntilCollapsed">

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -76,4 +77,4 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</androidx.coordinatorlayout.widget.CoordinatorLayout> <!-- app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" -->
</androidx.coordinatorlayout.widget.CoordinatorLayout> <!-- app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" -->

0 comments on commit d532158

Please sign in to comment.