Skip to content

Commit

Permalink
Fixes in tablet and dark version of the new UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
erickok committed Jun 24, 2015
1 parent 1fb1ef7 commit 25f7412
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 24 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 219
versionName '2.5.0-beta2'
versionCode 221
versionName '2.5.1'
}
buildTypes {
release {
Expand Down Expand Up @@ -37,8 +37,8 @@ dependencies {
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:support-annotations:20.0.0'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-annotations:22.1.1'
compile 'com.getbase:floatingactionbutton:1.8.0'
compile 'com.afollestad:material-dialogs:0.6.3.3'
compile 'com.nispok:snackbar:2.10.6'
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,13 @@ public boolean onPrepareOptionsMenu(Menu menu) {
// No connection yet; hide all menu options except settings
if (currentConnection == null) {
torrentsToolbar.setNavigationIcon(null);
if (selectionToolbar != null)
selectionToolbar.setVisibility(View.GONE);
addmenuButton.setVisibility(View.GONE);
actionsToolbar.setVisibility(View.GONE);
if (filtersList != null)
filtersList.setVisibility(View.GONE);
filterSearch.setVisibility(View.GONE);
torrentsToolbar.getMenu().findItem(R.id.action_search).setVisible(false);
torrentsToolbar.getMenu().findItem(R.id.action_rss).setVisible(false);
torrentsToolbar.getMenu().findItem(R.id.action_settings).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
Expand All @@ -474,8 +479,13 @@ public boolean onPrepareOptionsMenu(Menu menu) {
// There is a connection (read: settings to some server known)
if (drawerToggle != null)
torrentsToolbar.setNavigationIcon(R.drawable.ic_action_drawer);
if (selectionToolbar != null)
selectionToolbar.setVisibility(View.VISIBLE);
addmenuButton.setVisibility(View.VISIBLE);
actionsToolbar.setVisibility(View.VISIBLE);
if (filtersList != null)
filtersList.setVisibility(View.VISIBLE);
filterSearch.setVisibility(View.VISIBLE);
boolean addByFile = Daemon.supportsAddByFile(currentConnection.getType());
addmenuFileButton.setVisibility(addByFile ? View.VISIBLE : View.GONE);
// Primary toolbar menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.os.Build;
import android.os.Bundle;
import android.provider.SearchRecentSuggestions;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
Expand Down Expand Up @@ -74,8 +75,6 @@ public class SearchActivity extends ActionBarActivity implements ActionBar.OnNav
@Bean
protected ApplicationSettings applicationSettings;
@Bean
protected NavigationHelper navigationHelper;
@Bean
protected SearchHelper searchHelper;
@SystemService
protected SearchManager searchManager;
Expand Down Expand Up @@ -159,15 +158,15 @@ protected void init() {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
if (navigationHelper.enableSearchUi()) {
// Add an expandable SearchView to the action bar
MenuItem item = menu.findItem(R.id.action_search);
final SearchView searchView = new SearchView(searchToolbar.getContext());
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setQueryRefinementEnabled(true);
item.setActionView(searchView);
searchMenu = item;
}
// Add an expandable SearchView to the action bar
MenuItem item = menu.findItem(R.id.action_search);
final SearchView searchView = new SearchView(searchToolbar.getContext());
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setQueryRefinementEnabled(true);
//searchView.setIconified(false);
searchView.setIconifiedByDefault(false);
MenuItemCompat.setActionView(item, searchView);
searchMenu = item;
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -198,6 +199,10 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if (checked.size() > 1) {
Toast.makeText(getActivity(), getString(R.string.search_openingdetails, first.getName()), Toast.LENGTH_LONG).show();
}
if (TextUtils.isEmpty(first.getDetailsUrl())) {
Toast.makeText(getActivity(), getString(R.string.error_invalid_url_form, first.getName()), Toast.LENGTH_LONG).show();
return false;
}
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(first.getDetailsUrl())));
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ protected void navigateUp() {
@OnActivityResult(BarcodeHelper.ACTIVITY_BARCODE_QRSETTINGS)
public void onQrCodeScanned(int resultCode, Intent data) {
// We should have received Intent extras with the QR-decoded data representing Transdroid settings
if (data == null || !data.hasExtra("SCAN_RESULT"))
return; // Cancelled scan; ignore
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this);
String contents = data.getStringExtra("SCAN_RESULT");
String formatName = data.getStringExtra("SCAN_RESULT_FORMAT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public DaemonTaskResult executeTask(Log log, DaemonTask task) {
byte[] bytes = baos.toByteArray();
int size = (int) file.length() * 2;
final int XMLRPC_EXTRA_PADDING = 1280;
if (version >= 904) {
if (version >= 907) {
makeRtorrentCall(log, "network.xmlrpc.size_limit.set", new Object[]{size + XMLRPC_EXTRA_PADDING});
makeRtorrentCall(log, "load.raw_start", new Object[]{bytes});
} else {
Expand All @@ -191,7 +191,7 @@ public DaemonTaskResult executeTask(Log log, DaemonTask task) {

// Request to add a torrent by URL
String url = ((AddByUrlTask) task).getUrl();
if (version >= 904) {
if (version >= 907) {
makeRtorrentCall(log, "load.start", new String[]{"", url});
} else {
makeRtorrentCall(log, "load_start", new String[]{url});
Expand All @@ -202,7 +202,7 @@ public DaemonTaskResult executeTask(Log log, DaemonTask task) {

// Request to add a magnet link by URL
String magnet = ((AddByMagnetUrlTask) task).getUrl();
if (version >= 904) {
if (version >= 907) {
makeRtorrentCall(log, "load.start", new String[]{"", magnet});
} else {
makeRtorrentCall(log, "load_start", new String[]{magnet});
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_torrents.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
android:layout_width="@dimen/ui_filters_list"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:background="?attr/drawer_background"
android:orientation="vertical">

<ListView
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<style name="TransdroidTheme" parent="Theme.Transdroid.Light">
<item name="activatable_background">?android:attr/activatedBackgroundIndicator</item>
<item name="drawer_background">@color/background_light</item>
<item name="activatable_background">@drawable/activatable_background</item>
</style>

<style name="TransdroidTheme.Dark" parent="Theme.Transdroid.Dark">
<item name="activatable_background">?android:attr/selectableItemBackground</item>
<item name="drawer_background">@color/background_dark</item>
<item name="activatable_background">@drawable/activatable_background</item>
</style>

<style name="DefaultToolbar">
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
<attr name="progress" format="integer" />
<attr name="isActive" format="boolean" />
</declare-styleable>

<!-- Themeable drawables-->
<attr name="loading_progress" format="reference"/>
<attr name="activatable_background" format="reference"/>
<attr name="drawer_background" format="reference" />
<attr name="loading_progress" format="reference" />
<attr name="activatable_background" format="reference" />
<attr name="text_bright" format="reference" />
<attr name="text_actionbar" format="reference" />
<attr name="text_actionbar_secondary" format="reference" />
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
-->
<resources>
<string name="system_changelog">
Transdroid 2.5.1\n
- Improved rTorrent backwards compatibility\n
- UI fixes for dark theme\n
\n
Transdroid 2.5.0-beta2\n
- tTorrent support\n
- Fixed qBittorrent 3.2+ ratio bug\n
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<style name="TransdroidTheme" parent="Theme.Transdroid.Light">
<item name="drawer_background">@color/background_light</item>
<item name="activatable_background">@drawable/activatable_background</item>
</style>

<style name="TransdroidTheme.Dark" parent="Theme.Transdroid.Dark">
<item name="drawer_background">@color/background_dark</item>
<item name="activatable_background">@drawable/activatable_background</item>
</style>

Expand Down

0 comments on commit 25f7412

Please sign in to comment.