Fix ActionBar Home button issues on 3.X-4.0.X
This commit is contained in:
		
							parent
							
								
									5977f10ee6
								
							
						
					
					
						commit
						f205b67cd5
					
				@ -67,6 +67,8 @@ import android.view.View;
 | 
			
		||||
import android.view.ViewGroup;
 | 
			
		||||
import android.widget.BaseAdapter;
 | 
			
		||||
 | 
			
		||||
import android.support.v4.app.NavUtils;
 | 
			
		||||
 | 
			
		||||
import org.fdroid.fdroid.compat.PackageManagerCompat;
 | 
			
		||||
 | 
			
		||||
import com.nostra13.universalimageloader.core.ImageLoader;
 | 
			
		||||
@ -724,6 +726,10 @@ public class AppDetails extends ListActivity {
 | 
			
		||||
 | 
			
		||||
        switch (item.getItemId()) {
 | 
			
		||||
 | 
			
		||||
        case android.R.id.home:
 | 
			
		||||
            NavUtils.navigateUpFromSameTask(this);
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
        case LAUNCH:
 | 
			
		||||
            launchApk(app.id);
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,10 @@ import android.widget.ListView;
 | 
			
		||||
import android.widget.SimpleAdapter;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
 | 
			
		||||
import android.support.v4.app.NavUtils;
 | 
			
		||||
 | 
			
		||||
import org.fdroid.fdroid.compat.ActionBarCompat;
 | 
			
		||||
 | 
			
		||||
public class ManageRepo extends ListActivity {
 | 
			
		||||
 | 
			
		||||
    private final int ADD_REPO = 1;
 | 
			
		||||
@ -78,6 +82,9 @@ public class ManageRepo extends ListActivity {
 | 
			
		||||
    protected void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
 | 
			
		||||
        super.onCreate(savedInstanceState);
 | 
			
		||||
        ActionBarCompat abCompat = ActionBarCompat.create(this);
 | 
			
		||||
        abCompat.setDisplayHomeAsUpEnabled(true);
 | 
			
		||||
 | 
			
		||||
        setContentView(R.layout.repolist);
 | 
			
		||||
 | 
			
		||||
        SharedPreferences prefs = PreferenceManager
 | 
			
		||||
@ -192,6 +199,16 @@ public class ManageRepo extends ListActivity {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onOptionsItemSelected(MenuItem item) {
 | 
			
		||||
        switch (item.getItemId()) {
 | 
			
		||||
            case android.R.id.home:
 | 
			
		||||
                NavUtils.navigateUpFromSameTask(this);
 | 
			
		||||
                return true;
 | 
			
		||||
        }
 | 
			
		||||
        return super.onOptionsItemSelected(item);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onMenuItemSelected(int featureId, MenuItem item) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,10 @@ import android.os.Bundle;
 | 
			
		||||
import android.preference.Preference;
 | 
			
		||||
import android.preference.PreferenceActivity;
 | 
			
		||||
import android.preference.Preference.OnPreferenceClickListener;
 | 
			
		||||
import android.view.MenuItem;
 | 
			
		||||
 | 
			
		||||
import android.support.v4.app.NavUtils;
 | 
			
		||||
 | 
			
		||||
import org.fdroid.fdroid.compat.ActionBarCompat;
 | 
			
		||||
 | 
			
		||||
public class PreferencesActivity extends PreferenceActivity implements
 | 
			
		||||
@ -41,6 +45,16 @@ public class PreferencesActivity extends PreferenceActivity implements
 | 
			
		||||
        //}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onOptionsItemSelected(MenuItem item) {
 | 
			
		||||
        switch (item.getItemId()) {
 | 
			
		||||
            case android.R.id.home:
 | 
			
		||||
                NavUtils.navigateUpFromSameTask(this);
 | 
			
		||||
                return true;
 | 
			
		||||
        }
 | 
			
		||||
        return super.onOptionsItemSelected(item);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onPreferenceClick(Preference preference) {
 | 
			
		||||
        // Currently no actions are returned
 | 
			
		||||
 | 
			
		||||
@ -34,6 +34,9 @@ import android.view.MenuItem;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.widget.ListView;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
 | 
			
		||||
import android.support.v4.app.NavUtils;
 | 
			
		||||
 | 
			
		||||
import org.fdroid.fdroid.compat.ActionBarCompat;
 | 
			
		||||
import org.fdroid.fdroid.views.AppListAdapter;
 | 
			
		||||
import org.fdroid.fdroid.views.AvailableAppListAdapter;
 | 
			
		||||
@ -173,6 +176,10 @@ public class SearchResults extends ListActivity {
 | 
			
		||||
 | 
			
		||||
        switch (item.getItemId()) {
 | 
			
		||||
 | 
			
		||||
        case android.R.id.home:
 | 
			
		||||
            NavUtils.navigateUpFromSameTask(this);
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
        case SEARCH:
 | 
			
		||||
            onSearchRequested();
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user