Browse Source

Layout bugs fixed.

pull/11/head
Eric Kok 13 years ago
parent
commit
f9736fe1c7
  1. 5
      android/AndroidManifest.xml
  2. 4
      android/res/layout-xlarge-v11/part_actionbar_progressitem.xml
  3. 1
      android/res/layout/list_item_rssitem.xml
  4. 2
      android/src/org/transdroid/gui/Details.java
  5. 49
      android/src/org/transdroid/gui/DetailsFragment.java
  6. 21
      android/src/org/transdroid/gui/TorrentsFragment.java
  7. 3
      android/src/org/transdroid/gui/Transdroid.java
  8. 2
      lib/.classpath

5
android/AndroidManifest.xml

@ -18,7 +18,8 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.transdroid" package="org.transdroid"
android:versionName="1.1.0" android:versionCode="140" android:versionName="1.1.1"
android:versionCode="141"
android:installLocation="auto"> android:installLocation="auto">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" /> <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
@ -34,7 +35,7 @@
android:label="Transdroid Torrent Manager" android:label="Transdroid Torrent Manager"
android:description="@string/description" android:description="@string/description"
android:theme="@style/Theme.Transdroid" android:theme="@style/Theme.Transdroid"
android:hardwareAccelerated="true"> android:hardwareAccelerated="false">
<activity <activity
android:name="org.transdroid.gui.Torrents" android:name="org.transdroid.gui.Torrents"

4
android/res/layout-xlarge-v11/part_actionbar_progressitem.xml

@ -21,7 +21,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="12dip" android:layout_marginLeft="12dip"
android:layout_marginRight="16dip" android:layout_marginRight="17dip"
android:layout_marginTop="1dip"
android:layout_marginBottom="1dip"
android:text="@string/refresh" android:text="@string/refresh"
style="@android:style/TextAppearance.Medium" /> style="@android:style/TextAppearance.Medium" />
<!--android:textColor="@color/TitleTextColor" />--> <!--android:textColor="@color/TitleTextColor" />-->

1
android/res/layout/list_item_rssitem.xml

@ -18,7 +18,6 @@
android:layout_toRightOf="@id/rssitem_check" android:layout_toRightOf="@id/rssitem_check"
android:paddingRight="29dip" android:paddingRight="29dip"
android:paddingTop="5dip" android:paddingTop="5dip"
android:textSize="16dip"
style="@style/SearchNameText" /> style="@style/SearchNameText" />
<TextView <TextView

2
android/src/org/transdroid/gui/Details.java

@ -49,7 +49,7 @@ public class Details extends FragmentActivity {
// Start the fragment for this torrent // Start the fragment for this torrent
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.details, new DetailsFragment(daemonNumber, torrent, existingLabels)); ft.replace(R.id.details, new DetailsFragment(null, daemonNumber, torrent, existingLabels));
if (getSupportFragmentManager().findFragmentById(R.id.details) != null) { if (getSupportFragmentManager().findFragmentById(R.id.details) != null) {
ft.addToBackStack(null); ft.addToBackStack(null);
} }

49
android/src/org/transdroid/gui/DetailsFragment.java

@ -82,11 +82,11 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
private static final int FILEMENU_REMOTESTART_ID = 5; private static final int FILEMENU_REMOTESTART_ID = 5;
private static final int FILEMENU_FTPDOWNLOAD_ID = 6; private static final int FILEMENU_FTPDOWNLOAD_ID = 6;
private static final int MENU_FORCESTART_ID = 0; private static final int MENU_FORCESTART_ID = 50;
private static final int MENU_SETLOCATION_ID = 1; private static final int MENU_SETLOCATION_ID = 51;
private static final int MENU_EDITTRACKERS_ID = 2; private static final int MENU_EDITTRACKERS_ID = 52;
private static final int MENU_INVERTSELECTION_ID = 3; private static final int MENU_INVERTSELECTION_ID = 53;
private static final int MENU_REFRESH_ID = 4; private static final int MENU_REFRESH_ID = 54;
static final int DIALOG_ASKREMOVE = 11; static final int DIALOG_ASKREMOVE = 11;
private static final int DIALOG_INSTALLVLC = 12; private static final int DIALOG_INSTALLVLC = 12;
@ -98,6 +98,7 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
TorrentFilesSortBy sortSetting = TorrentFilesSortBy.Alphanumeric; TorrentFilesSortBy sortSetting = TorrentFilesSortBy.Alphanumeric;
boolean sortReversed = false; boolean sortReversed = false;
private TorrentsFragment torrentsFragment;
private final int daemonNumber; private final int daemonNumber;
private Torrent torrent; private Torrent torrent;
private TorrentDetails fineDetails = null; private TorrentDetails fineDetails = null;
@ -108,7 +109,8 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
private LinearLayout prioBar; private LinearLayout prioBar;
private Button prioOff, prioLow, prioNormal, prioHigh; private Button prioOff, prioLow, prioNormal, prioHigh;
public DetailsFragment(int daemonNumber, Torrent torrent, String[] existingLabels) { public DetailsFragment(TorrentsFragment torrentsFragment, int daemonNumber, Torrent torrent, String[] existingLabels) {
this.torrentsFragment = torrentsFragment;
this.daemonNumber = daemonNumber; this.daemonNumber = daemonNumber;
this.torrent = torrent; this.torrent = torrent;
this.existingLabels = existingLabels; this.existingLabels = existingLabels;
@ -537,6 +539,10 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
@Override @Override
public void onTaskFailure(DaemonTaskFailureResult result) { public void onTaskFailure(DaemonTaskFailureResult result) {
if (getActivity() == null) {
// No longer visible
return;
}
// Show error message // Show error message
Toast.makeText(getActivity(), LocalTorrent.getResourceForDaemonException(result.getException()), Toast.makeText(getActivity(), LocalTorrent.getResourceForDaemonException(result.getException()),
Toast.LENGTH_SHORT * 2).show(); Toast.LENGTH_SHORT * 2).show();
@ -596,6 +602,10 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
case Pause: case Pause:
torrent.mimicPause(); torrent.mimicPause();
getDetailsListAdapter().updateViewsAndButtonStates(); getDetailsListAdapter().updateViewsAndButtonStates();
// Also call back to the main torrents list to update its view
if (torrentsFragment != null) {
torrentsFragment.updateTorrentList();
}
break; break;
case Resume: case Resume:
@ -603,11 +613,19 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
getDetailsListAdapter().updateViewsAndButtonStates(); getDetailsListAdapter().updateViewsAndButtonStates();
queue.enqueue(RetrieveTask.create(daemon)); queue.enqueue(RetrieveTask.create(daemon));
queue.enqueue(GetFileListTask.create(daemon, torrent)); queue.enqueue(GetFileListTask.create(daemon, torrent));
// Also call back to the main torrents list to update its view
if (torrentsFragment != null) {
torrentsFragment.updateTorrentList();
}
break; break;
case Stop: case Stop:
torrent.mimicStop(); torrent.mimicStop();
getDetailsListAdapter().updateViewsAndButtonStates(); getDetailsListAdapter().updateViewsAndButtonStates();
// Also call back to the main torrents list to update its view
if (torrentsFragment != null) {
torrentsFragment.updateTorrentList();
}
break; break;
case Start: case Start:
@ -615,6 +633,10 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
getDetailsListAdapter().updateViewsAndButtonStates(); getDetailsListAdapter().updateViewsAndButtonStates();
queue.enqueue(RetrieveTask.create(daemon)); queue.enqueue(RetrieveTask.create(daemon));
queue.enqueue(GetFileListTask.create(daemon, torrent)); queue.enqueue(GetFileListTask.create(daemon, torrent));
// Also call back to the main torrents list to update its view
if (torrentsFragment != null) {
torrentsFragment.updateTorrentList();
}
break; break;
case Remove: case Remove:
@ -624,11 +646,18 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
"'" + result.getTargetTorrent().getName() + "' " "'" + result.getTargetTorrent().getName() + "' "
+ getText(includingData ? R.string.torrent_removed_with_data : R.string.torrent_removed), + getText(includingData ? R.string.torrent_removed_with_data : R.string.torrent_removed),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
// Also call back to the main torrents list to update its view
if (torrentsFragment != null) {
torrentsFragment.updateTorrentList();
}
// Close this details fragment // Close this details fragment
FragmentTransaction ft = getSupportActivity().getSupportFragmentManager().beginTransaction(); if (torrentsFragment != null) {
ft.remove(this); FragmentTransaction ft = getSupportActivity().getSupportFragmentManager().beginTransaction();
ft.addToBackStack(null); ft.remove(this);
ft.commit(); ft.commit();
} else {
getSupportActivity().getSupportFragmentManager().popBackStack();
}
break; break;
case SetDownloadLocation: case SetDownloadLocation:

21
android/src/org/transdroid/gui/TorrentsFragment.java

@ -979,7 +979,8 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
// Show the details in the right of the screen (tablet interface) or separately // Show the details in the right of the screen (tablet interface) or separately
if (useTabletInterface) { if (useTabletInterface) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.details, new DetailsFragment(lastUsedDaemonSettings, tor, buildLabelTexts(false))); ft.replace(R.id.details, new DetailsFragment(TorrentsFragment.this, lastUsedDaemonSettings, tor,
buildLabelTexts(false)));
ft.commit(); ft.commit();
} else { } else {
Intent i = new Intent(getActivity(), Details.class); Intent i = new Intent(getActivity(), Details.class);
@ -1377,7 +1378,7 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
} }
} }
private void updateTorrentList() { public void updateTorrentList() {
if (daemon != null) { if (daemon != null) {
queue.enqueue(RetrieveTask.create(daemon)); queue.enqueue(RetrieveTask.create(daemon));
} }
@ -1750,13 +1751,9 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
taskmessage.setText(taskmessageText); taskmessage.setText(taskmessageText);
taskmessage.setVisibility(View.VISIBLE); taskmessage.setVisibility(View.VISIBLE);
statusBox.setVisibility(View.GONE); statusBox.setVisibility(View.GONE);
emptyText.setVisibility(View.VISIBLE); if (allTorrents == null) {
getListView().setVisibility(View.GONE); emptyText.setVisibility(View.VISIBLE);
/*if (getSupportFragmentManager().findFragmentById(R.id.details) != null) { }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.remove(getSupportFragmentManager().findFragmentById(R.id.details));
ft.commit();
}*/
return; return;
} }
@ -1767,7 +1764,7 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
int eta = -1; int eta = -1;
int seeding = 0; int seeding = 0;
int seedingU = 0; int seedingU = 0;
int other = 0; //int other = 0;
for (Torrent tor : allTorrents) { for (Torrent tor : allTorrents) {
if (tor.getStatusCode() == TorrentStatus.Downloading && (!onlyShowTransferring || tor.getRateDownload() > 0)) { if (tor.getStatusCode() == TorrentStatus.Downloading && (!onlyShowTransferring || tor.getRateDownload() > 0)) {
downloading++; downloading++;
@ -1777,8 +1774,8 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
} else if (tor.getStatusCode() == TorrentStatus.Seeding && (!onlyShowTransferring || tor.getRateUpload() > 0)) { } else if (tor.getStatusCode() == TorrentStatus.Seeding && (!onlyShowTransferring || tor.getRateUpload() > 0)) {
seeding++; seeding++;
seedingU += tor.getRateUpload(); seedingU += tor.getRateUpload();
} else { //} else {
other++; // other++;
} }
} }

3
android/src/org/transdroid/gui/Transdroid.java

@ -60,7 +60,8 @@ public class Transdroid {
public static boolean isTablet(Resources r) { public static boolean isTablet(Resources r) {
//boolean hasLargeScreen = ((r.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE); //boolean hasLargeScreen = ((r.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
boolean hasXLargeScreen = ((r.getConfiguration().screenLayout & boolean hasXLargeScreen = ((r.getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE); Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) &&
android.os.Build.VERSION.SDK_INT >= 11;
return hasXLargeScreen; return hasXLargeScreen;
} }

2
lib/.classpath

@ -2,6 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="/var/data/Dev/android-sdk/platforms/android-13/android.jar"/> <classpathentry kind="lib" path="/home/eric/Dev/android-sdk/platforms/android-13/android.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

Loading…
Cancel
Save