Only use 3.X workarounds on 3.X

This commit is contained in:
Daniel Martí 2015-04-06 22:07:07 +02:00
parent 2f80d37c24
commit c7b16c6713
4 changed files with 15 additions and 4 deletions

View File

@ -18,6 +18,7 @@
package org.fdroid.fdroid; package org.fdroid.fdroid;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
@ -44,7 +45,9 @@ public class PreferencesActivity extends ActionBarActivity {
// a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before // a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before
// the actionbar is played with: // the actionbar is played with:
// http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html // http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html
setContentView(new LinearLayout(this)); if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) {
setContentView(new LinearLayout(this));
}
PreferencesFragment preferencesFragment = new PreferencesFragment(); PreferencesFragment preferencesFragment = new PreferencesFragment();
fm.beginTransaction() fm.beginTransaction()

View File

@ -19,6 +19,7 @@
package org.fdroid.fdroid; package org.fdroid.fdroid;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
@ -50,7 +51,9 @@ public class SearchResults extends ActionBarActivity {
// a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before // a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before
// the actionbar is played with: // the actionbar is played with:
// http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html // http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html
setContentView(new LinearLayout(this)); if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) {
setContentView(new LinearLayout(this));
}
SearchResultsFragment fragment = new SearchResultsFragment(); SearchResultsFragment fragment = new SearchResultsFragment();
fm.beginTransaction().add(android.R.id.content, fragment).commit(); fm.beginTransaction().add(android.R.id.content, fragment).commit();

View File

@ -31,6 +31,7 @@ import android.net.Uri;
import android.net.wifi.WifiInfo; import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -125,7 +126,9 @@ public class ManageReposActivity extends ActionBarActivity {
* http://blog.perpetumdesign.com/2011/08/strange-case-of * http://blog.perpetumdesign.com/2011/08/strange-case-of
* -dr-action-and-mr-bar.html * -dr-action-and-mr-bar.html
*/ */
setContentView(new LinearLayout(this)); if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) {
setContentView(new LinearLayout(this));
}
fm.beginTransaction() fm.beginTransaction()
.add(android.R.id.content, new RepoListFragment()) .add(android.R.id.content, new RepoListFragment())

View File

@ -43,7 +43,9 @@ public class RepoDetailsActivity extends ActionBarActivity {
// a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before // a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before
// the actionbar is played with: // the actionbar is played with:
// http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html // http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html
setContentView(new LinearLayout(this)); if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) {
setContentView(new LinearLayout(this));
}
RepoDetailsFragment fragment = new RepoDetailsFragment(); RepoDetailsFragment fragment = new RepoDetailsFragment();
fragment.setArguments(getIntent().getExtras()); fragment.setArguments(getIntent().getExtras());