本文整理汇总了Java中android.support.v7.app.AppCompatDelegate.setCompatVectorFromResourcesEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java AppCompatDelegate.setCompatVectorFromResourcesEnabled方法的具体用法?Java AppCompatDelegate.setCompatVectorFromResourcesEnabled怎么用?Java AppCompatDelegate.setCompatVectorFromResourcesEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.AppCompatDelegate
的用法示例。
在下文中一共展示了AppCompatDelegate.setCompatVectorFromResourcesEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
Utils.DARK_THEME = Prefs.getBoolean("darktheme", false, this);
int theme;
String accent = Prefs.getString("accent_color", "pink_accent", this);
if (Utils.DARK_THEME) {
theme = sAccentDarkColors.get(accent);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
theme = sAccentColors.get(accent);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
setTheme(theme);
super.onCreate(savedInstanceState);
if (Prefs.getBoolean("forceenglish", false, this)) {
Utils.setLocale("en_US", this);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && setStatusBarColor()) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(statusBarColor());
}
}
示例2: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(TAG, "onCreate: ");
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
FragmentManager fragmentManager = getFragmentManager();
settingsFragment = (SettingsFragment) fragmentManager.findFragmentByTag(TAG);
if (settingsFragment == null) {
settingsFragment = SettingsFragment.newInstance(R.xml.settings_main);
replaceFragment(settingsFragment);
} else {
showFragment(settingsFragment);
}
}
示例3: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
setContentView(R.layout.activity_tutorias);
//Action bar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.colorPrimaryDarkGreen));
getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDarkGreen));
}
app = (App) this.getApplication();
//SetView
viewPager = (ViewPager) findViewById(R.id.viewpager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
progress = (AVLoadingIndicatorView) findViewById(R.id.material_progress);
title = (TextView) findViewById(R.id.toolbar_title);
fabTut = (FloatingActionButton) findViewById(R.id.fabTut);
setYearAdapters();
request = new TutoriasRequest(this);
updateYear(true, app.getPublicPreferenceI(Common.GLOBAL_FILTER_YEAR));
doRequest();
}
示例4: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
setContentView(R.layout.activity_horario);
//Action bar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.colorPrimaryDarkGreen));
getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDarkGreen));
}
app = (App) getApplication();
if (app.account == null && !app.loadUser()) //If account is null and cannot create user
super.onDestroy();
mLayoutManager = new LinearLayoutManager(this);
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView = (RecyclerView) findViewById(R.id.horarioRecycler);
emptyView = (LinearLayout) findViewById(R.id.horario_blank);
recyclerView.setLayoutManager(mLayoutManager);
initializePicker();
getDateData(new Date());
}
示例5: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
helper_main.setTheme(this);
setContentView(R.layout.activity_settings);
helper_main.onStart(Activity_settings_start.this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(R.string.pref_3);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
if(actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
PreferenceManager.setDefaultValues(this, R.xml.user_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_search, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_app, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_close, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_start, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_search_main, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_data, false);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
sharedPref.edit().putString("started", "").apply();
// Display the fragment as the activity_screen_main content
getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
}
示例6: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
setContentView(R.layout.activity_main);
//load last known location from SharedPreferences
lastKnownLocation = new StorageUtil(this).getLastKnownLocation();
if (lastKnownLocation == null) {
registerReceiver(locationEnabledReceiver, new IntentFilter("LOCATION_ENABLED"));
}
//request permissions
requestWriteExternalStoragePermission();
getStatusBatColor();
updateStatusBarColor();
viewSetup();
setupOsmConnection();
// AppLog.log("OAUTH");
// AppLog.log(osm.getUserAgent());
// AppLog.log(osm.getApiUrl());
// AppLog.log(osm.getOAuth().getConsumerKey());
// AppLog.log(osm.getOAuth().getConsumerSecret());
// AppLog.log(osm.getOAuth().getRequestParameters());
// logUserInfo();
}
示例7: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
helper_main.setTheme(this);
setContentView(R.layout.activity_settings);
helper_main.onStart(Activity_settings_app.this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(R.string.pref_2);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
if(actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
PreferenceManager.setDefaultValues(this, R.xml.user_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_search, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_app, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_close, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_start, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_search_main, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_data, false);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
sharedPref.edit().putString("started", "").apply();
// Display the fragment as the activity_screen_main content
getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
}
示例8: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mPrefs = new PreferenceManager(this);
Fresco.initialize(this);
SugarContext.init(this);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
if (mPrefs.getRemoteAccessActive())
startServer();
}
示例9: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLifecycleRegistry = new LifecycleRegistry(this);
mLifecycleRegistry.markState(Lifecycle.State.CREATED);
navigator = NavigatorFactory.getInstance();
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
restoreViewStateFromBundle(savedInstanceState);
initialize();
setupUI(savedInstanceState == null);
}
示例10: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
helper_main.setTheme(this);
setContentView(R.layout.activity_settings);
helper_main.onStart(Activity_settings_close.this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(R.string.pref_5);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
if(actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
PreferenceManager.setDefaultValues(this, R.xml.user_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_search, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_app, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_close, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_start, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_search_main, false);
PreferenceManager.setDefaultValues(this, R.xml.user_settings_data, false);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
sharedPref.edit().putString("started", "").apply();
// Display the fragment as the activity_screen_main content
getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
}
示例11: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
initialiseDependencyInjection();
if (BuildConfig.DEBUG) {
initTimberDebugPlant();
}
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
示例12: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
systemOut = new InterceptorOutputStream(System.out, out);
systemErr = new InterceptorOutputStream(System.err, err);
System.setOut(systemOut);
System.setErr(systemErr);
//for log cat
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
示例13: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
navigator = NavigatorFactory.getInstance();
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
restoreViewStateFromBundle(savedInstanceState);
initialize();
setupUI(savedInstanceState == null);
}
示例14: NoInternetDialog
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
private NoInternetDialog(@NonNull Context context, int bgGradientStart, int bgGradientCenter, int bgGradientEnd,
int bgGradientOrientation, int bgGradientType, float dialogRadius,
@Nullable Typeface titleTypeface, @Nullable Typeface messageTypeface,
int buttonColor, int buttonTextColor, int buttonIconsColor, int wifiLoaderColor,
boolean cancelable) {
super(context);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
isHalloween = NoInternetUtils.getCurrentDate().equals("10-31");
this.bgGradientStart = bgGradientStart == 0
? (isHalloween
? ContextCompat.getColor(getContext(), R.color.colorNoInternetGradStartH)
: ContextCompat.getColor(getContext(), R.color.colorNoInternetGradStart))
: bgGradientStart;
this.bgGradientCenter = bgGradientCenter == 0
? (isHalloween
? ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH)
: ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenter))
: bgGradientCenter;
this.bgGradientEnd = bgGradientEnd == 0
? (isHalloween
? ContextCompat.getColor(getContext(), R.color.colorNoInternetGradEndH)
: ContextCompat.getColor(getContext(), R.color.colorNoInternetGradEnd))
: bgGradientEnd;
this.bgGradientOrientation = bgGradientOrientation < 10 || bgGradientOrientation > 17 ? ORIENTATION_TOP_BOTTOM : bgGradientOrientation;
this.bgGradientType = bgGradientType <= 0 || bgGradientType > 2 ? GRADIENT_LINEAR : bgGradientType;
this.dialogRadius = dialogRadius == 0 ? RADIUS : dialogRadius;
if (dialogRadius == NO_RADIUS) {
this.dialogRadius = 0f;
}
this.titleTypeface = titleTypeface;
this.messageTypeface = messageTypeface;
this.buttonColor = buttonColor == 0
? (isHalloween
? ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH)
: ContextCompat.getColor(getContext(), R.color.colorAccent))
: buttonColor;
this.buttonTextColor = buttonTextColor == 0
? ContextCompat.getColor(getContext(), R.color.colorWhite)
: buttonTextColor;
this.buttonIconsColor = buttonIconsColor == 0
? ContextCompat.getColor(getContext(), R.color.colorWhite)
: buttonIconsColor;
this.wifiLoaderColor = wifiLoaderColor == 0
? ContextCompat.getColor(getContext(), R.color.colorWhite)
: wifiLoaderColor;
this.cancelable = cancelable;
initReceivers(context);
}
示例15: onCreate
import android.support.v7.app.AppCompatDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
setContentView(R.layout.activity_web);
name = getIntent().getExtras().getString(Common.WEBVIEW_EXTRA_NAME);
url = getIntent().getExtras().getString(Common.WEBVIEW_EXTRA_URL);
color = getIntent().getExtras().getInt(Common.WEBVIEW_EXTRA_COLOR);
needsLogin = getIntent().getExtras().getBoolean(Common.WEBVIEW_EXTRA_NLOGIN);
//Action bar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(color);
getWindow().setStatusBarColor(color);
}
app = (App) getApplication();
if (app.account == null && !app.loadUser()) //If account is null and cannot create user
super.onDestroy();
TextView title = (TextView) findViewById(R.id.toolbar_title);
title.setText(name);
progress = (ProgressBar) findViewById(R.id.web_progressBar);
webView = (WebView) findViewById(R.id.webView);
if (savedInstanceState != null) {
progress.setVisibility(View.INVISIBLE);
webView.setVisibility(View.VISIBLE);
webView.restoreState(savedInstanceState);
}
else {
progress.setVisibility(View.VISIBLE);
webView.setWebViewClient(new WebViewClient());
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setUserAgentString("IEMobile");
startControllers();
}
}