Fix for fragment not displaying on 2.3 device.

Also, app details now goes to the "Swap app list" rather than the main list of
apps after hitting the "Up" button from the ActionBar.
This commit is contained in:
Peter Serwylo 2014-11-15 22:26:55 +11:00
parent 842ddb5e24
commit f5ce318be7
3 changed files with 42 additions and 11 deletions

View File

@ -329,6 +329,14 @@
</intent-filter>
</activity>
<activity
android:name=".views.swap.SwapAppListActivity$SwapAppDetails"
android:label="@string/app_details"
android:parentActivityName=".views.swap.SwapAppListActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.swap.SwapAppListActivity" />
</activity>
<activity
android:label="@string/menu_preferences"
android:name=".PreferencesActivity"

View File

@ -6,6 +6,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBarActivity;
@ -83,15 +84,21 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
setContentView(R.layout.swap_activity);
showFragment(new StartSwapFragment(), STATE_START_SWAP);
new Handler().post(new Runnable() {
@Override
public void run() {
if (FDroidApp.isLocalRepoServiceRunning()) {
showSelectApps();
showJoinWifi();
attemptToShowNfc();
showWifiQr();
}
showFragment(new StartSwapFragment(), STATE_START_SWAP);
if (FDroidApp.isLocalRepoServiceRunning()) {
showSelectApps();
showJoinWifi();
attemptToShowNfc();
showWifiQr();
}
}
});
}
}

View File

@ -2,8 +2,11 @@ package org.fdroid.fdroid.views.swap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBarActivity;
import org.fdroid.fdroid.AppDetails;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.data.AppProvider;
import org.fdroid.fdroid.views.AppListAdapter;
@ -18,10 +21,15 @@ public class SwapAppListActivity extends ActionBarActivity {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
getSupportFragmentManager()
.beginTransaction()
.add(android.R.id.content, new SwapAppListFragment())
.commit();
new Handler().post(new Runnable() {
@Override
public void run() {
getSupportFragmentManager()
.beginTransaction()
.add(android.R.id.content, new SwapAppListFragment())
.commit();
}
});
}
}
@ -56,4 +64,12 @@ public class SwapAppListActivity extends ActionBarActivity {
}
/**
* Here so that the AndroidManifest.xml can specify the "parent" activity from this
* can be different form the regular AppDetails. That is - the AppDetails goes back
* to the main app list, but the SwapAppDetails will go back to the "Swap app list"
* activity.
*/
public static class SwapAppDetails extends AppDetails {}
}