123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*
- * Copyright (C) 2015 Bilibili
- * Copyright (C) 2015 Zhang Rui <bbcallen@gmail.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- package com.edufound.mobile.ijkplayer.application;
- import android.content.Context;
- import android.content.SharedPreferences;
- import android.preference.PreferenceManager;
- import com.edufound.mobile.R;
- public class Settings {
- private Context mAppContext;
- private SharedPreferences mSharedPreferences;
- public static final int PV_PLAYER__AndroidMediaPlayer = 1;
- public static final int PV_PLAYER__IjkMediaPlayer = 2;
- public static final int PV_PLAYER__IjkExoMediaPlayer = 3;
- public Settings(Context context) {
- mAppContext = context.getApplicationContext();
- mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mAppContext);
- }
- public boolean getEnableBackgroundPlay() {
- String key = mAppContext.getString(R.string.pref_key_enable_background_play);
- return mSharedPreferences.getBoolean(key, false);
- }
- public int getPlayer() {
- String key = mAppContext.getString(R.string.pref_key_player);
- String value = mSharedPreferences.getString(key, "");
- try {
- return Integer.valueOf(value).intValue();
- } catch (NumberFormatException e) {
- return 0;
- }
- }
- public boolean getUsingMediaCodec() {
- String key = mAppContext.getString(R.string.pref_key_using_media_codec);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getUsingMediaCodecAutoRotate() {
- String key = mAppContext.getString(R.string.pref_key_using_media_codec_auto_rotate);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getMediaCodecHandleResolutionChange() {
- String key = mAppContext.getString(R.string.pref_key_media_codec_handle_resolution_change);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getUsingOpenSLES() {
- String key = mAppContext.getString(R.string.pref_key_using_opensl_es);
- return mSharedPreferences.getBoolean(key, false);
- }
- public String getPixelFormat() {
- String key = mAppContext.getString(R.string.pref_key_pixel_format);
- return mSharedPreferences.getString(key, "");
- }
- public boolean getEnableNoView() {
- String key = mAppContext.getString(R.string.pref_key_enable_no_view);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getEnableSurfaceView() {
- String key = mAppContext.getString(R.string.pref_key_enable_surface_view);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getEnableTextureView() {
- String key = mAppContext.getString(R.string.pref_key_enable_texture_view);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getEnableDetachedSurfaceTextureView() {
- String key = mAppContext.getString(R.string.pref_key_enable_detached_surface_texture);
- return mSharedPreferences.getBoolean(key, false);
- }
- public boolean getUsingMediaDataSource() {
- String key = mAppContext.getString(R.string.pref_key_using_mediadatasource);
- return mSharedPreferences.getBoolean(key, false);
- }
- }
|