Use requestWindowFeature instead of support version

supportRequestWindowFeature throws a NullpointerException in some cases

closes #479
This commit is contained in:
daniel oeh 2014-08-01 11:52:15 +02:00
parent 988b327efe
commit df28eb6b04
2 changed files with 41 additions and 2 deletions

View File

@ -6,12 +6,12 @@ import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.WindowCompat;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
@ -50,10 +50,11 @@ public class VideoplayerActivity extends MediaplayerActivity {
setTheme(R.style.Theme_AntennaPod_Dark); setTheme(R.style.Theme_AntennaPod_Dark);
} }
@SuppressLint("AppCompatMethod")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= 11) { if (Build.VERSION.SDK_INT >= 11) {
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
} }
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -0,0 +1,38 @@
package instrumentationTest.de.test.antennapod.ui;
import android.test.ActivityInstrumentationTestCase2;
import com.robotium.solo.Solo;
import de.danoeh.antennapod.activity.VideoplayerActivity;
/**
* Test class for VideoplayerActivity
*/
public class VideoplayerActivityTest extends ActivityInstrumentationTestCase2<VideoplayerActivity> {
private Solo solo;
public VideoplayerActivityTest() {
super(VideoplayerActivity.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
super.tearDown();
}
/**
* Test if activity can be started.
*/
public void testStartActivity() throws Exception {
solo.waitForActivity(VideoplayerActivity.class);
}
}