Skip to content

Commit

Permalink
Added non-permanent options disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Jan 11, 2021
1 parent 608d6c0 commit cae0a22
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CommonUtils
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public static Aria2Helper instantiate(@NonNull Context context) throws Initializ
}
}

public boolean isInAppDownloader() {
return client.isInAppDownloader();
}

private void processGlobalOptionsUpdate(@NonNull JSONObject newOptions) {
if (!client.isInAppDownloader()) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
return null;
}

layout.findViewById(R.id.optionsDialog_notPermanentOptionsDisclaimer)
.setVisibility(helper.isInAppDownloader() ? View.VISIBLE : View.GONE);

helper.request(req, this);

return layout;
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/res/layout/dialog_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp" />

<ProgressBar
Expand All @@ -24,6 +25,17 @@
android:layout_margin="48dp" />
</FrameLayout>

<TextView
android:id="@+id/optionsDialog_notPermanentOptionsDisclaimer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:text="@string/notPermanentOptionsDisclaimer"
android:textAlignment="center"
android:visibility="gone" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -37,7 +49,7 @@
android:layout_height="wrap_content"
android:text="@android:string/cancel" />

<View
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,5 @@
<string name="prefs_clearWebViewCookies">Clear WebView cookies</string>
<string name="prefs_clearWebViewCookies_summary">Clear the cookies when the WebView is opened.</string>
<string name="clearCookies">Clear cookies</string>
<string name="notPermanentOptionsDisclaimer">These options will be reset upon restart. You may want to edit them from the profile settings.</string>
</resources>

0 comments on commit cae0a22

Please sign in to comment.