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:
		
							parent
							
								
									842ddb5e24
								
							
						
					
					
						commit
						f5ce318be7
					
				@ -329,6 +329,14 @@
 | 
				
			|||||||
            </intent-filter>
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        </activity>
 | 
					        </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
 | 
					        <activity
 | 
				
			||||||
            android:label="@string/menu_preferences"
 | 
					            android:label="@string/menu_preferences"
 | 
				
			||||||
            android:name=".PreferencesActivity"
 | 
					            android:name=".PreferencesActivity"
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,7 @@ import android.net.Uri;
 | 
				
			|||||||
import android.os.AsyncTask;
 | 
					import android.os.AsyncTask;
 | 
				
			||||||
import android.os.Bundle;
 | 
					import android.os.Bundle;
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					import android.os.Handler;
 | 
				
			||||||
import android.support.v4.app.Fragment;
 | 
					import android.support.v4.app.Fragment;
 | 
				
			||||||
import android.support.v4.app.FragmentManager;
 | 
					import android.support.v4.app.FragmentManager;
 | 
				
			||||||
import android.support.v7.app.ActionBarActivity;
 | 
					import android.support.v7.app.ActionBarActivity;
 | 
				
			||||||
@ -83,6 +84,10 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            setContentView(R.layout.swap_activity);
 | 
					            setContentView(R.layout.swap_activity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            new Handler().post(new Runnable() {
 | 
				
			||||||
 | 
					                @Override
 | 
				
			||||||
 | 
					                public void run() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    showFragment(new StartSwapFragment(), STATE_START_SWAP);
 | 
					                    showFragment(new StartSwapFragment(), STATE_START_SWAP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (FDroidApp.isLocalRepoServiceRunning()) {
 | 
					                    if (FDroidApp.isLocalRepoServiceRunning()) {
 | 
				
			||||||
@ -93,6 +98,8 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,11 @@ package org.fdroid.fdroid.views.swap;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import android.net.Uri;
 | 
					import android.net.Uri;
 | 
				
			||||||
import android.os.Bundle;
 | 
					import android.os.Bundle;
 | 
				
			||||||
 | 
					import android.os.Handler;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
import android.support.v7.app.ActionBarActivity;
 | 
					import android.support.v7.app.ActionBarActivity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.fdroid.fdroid.AppDetails;
 | 
				
			||||||
import org.fdroid.fdroid.R;
 | 
					import org.fdroid.fdroid.R;
 | 
				
			||||||
import org.fdroid.fdroid.data.AppProvider;
 | 
					import org.fdroid.fdroid.data.AppProvider;
 | 
				
			||||||
import org.fdroid.fdroid.views.AppListAdapter;
 | 
					import org.fdroid.fdroid.views.AppListAdapter;
 | 
				
			||||||
@ -18,11 +21,16 @@ public class SwapAppListActivity extends ActionBarActivity {
 | 
				
			|||||||
        super.onCreate(savedInstanceState);
 | 
					        super.onCreate(savedInstanceState);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (savedInstanceState == null) {
 | 
					        if (savedInstanceState == null) {
 | 
				
			||||||
 | 
					            new Handler().post(new Runnable() {
 | 
				
			||||||
 | 
					                @Override
 | 
				
			||||||
 | 
					                public void run() {
 | 
				
			||||||
                    getSupportFragmentManager()
 | 
					                    getSupportFragmentManager()
 | 
				
			||||||
                        .beginTransaction()
 | 
					                        .beginTransaction()
 | 
				
			||||||
                        .add(android.R.id.content, new SwapAppListFragment())
 | 
					                        .add(android.R.id.content, new SwapAppListFragment())
 | 
				
			||||||
                        .commit();
 | 
					                        .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 {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user