當前位置: 首頁>>代碼示例>>Java>>正文


Java BackgroundManager類代碼示例

本文整理匯總了Java中android.support.v17.leanback.app.BackgroundManager的典型用法代碼示例。如果您正苦於以下問題:Java BackgroundManager類的具體用法?Java BackgroundManager怎麽用?Java BackgroundManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BackgroundManager類屬於android.support.v17.leanback.app包,在下文中一共展示了BackgroundManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DebouncedImageLoader

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
public DebouncedImageLoader(Context context, BackgroundManager backgroundManager, int width, int height) {
    mBackgroundManager = backgroundManager;
    Observable.create(this)
            .debounce(1, TimeUnit.SECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(posterProvider -> {
                Glide.with(context)
                        .load(posterProvider.providePosterURL())
                        .asBitmap()
                        .centerCrop()
                        .into(new SimpleTarget<Bitmap>(width, height) {
                            @Override
                            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap>
                                    glideAnimation) {
                                mBackgroundManager.setBitmap(resource);
                            }
                        });
            });
}
 
開發者ID:CrazyDude1994,項目名稱:lostfilm-android-client,代碼行數:20,代碼來源:DebouncedImageLoader.java

示例2: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate " + savedInstanceState);
    super.onCreate(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    mDisplayMode = readDisplayModePref(mPrefs);

    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    if(!bgMngr.isAttached())
        bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(getResources().getColor(R.color.leanback_background));

    setTitle(getArguments().getString(ARG_TITLE));
    mUri = getArguments().getParcelable(ARG_URI);
    mIsRoot = getArguments().getBoolean(ARG_IS_ROOT, false);

    setupEventListeners();

    // NOTE: onCreate is called only when the fragment is first created, not when it is back from backstack
    initGridOrList();

    mRefreshOnNextResume = true;
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:25,代碼來源:ListingFragment.java

示例3: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(getResources().getColor(R.color.leanback_background));

    mShortcut = (Shortcut)getActivity().getIntent().getSerializableExtra(EXTRA_SHORTCUT);

    DetailsOverviewRow detailRow = new DetailsOverviewRow(mShortcut);
    detailRow.setImageScaleUpAllowed(false);
    addActions(detailRow);
    mDetailsRowPresenter = new FullWidthDetailsOverviewRowPresenter(new ShortcutDetailsPresenter());

    mDetailsRowPresenter.setBackgroundColor(getResources().getColor(R.color.lightblue900));
    mDetailsRowPresenter.setOnActionClickedListener(this);

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(mDetailsRowPresenter);
    adapter.add(detailRow);
    setAdapter(adapter);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:23,代碼來源:NetworkShortcutDetailsFragment.java

示例4: onActivityCreated

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(getResources().getColor(R.color.leanback_background));

    setTitle(getString(R.string.network_storage));
    setHeadersState(HEADERS_DISABLED);
    setHeadersTransitionOnBackEnabled(false);

    loadRows();

    // Launch the shortcuts loading async task
    mShortcutsLoaderTask = new ShortcutsLoaderTask();
    mShortcutsLoaderTask.execute();
    mFtpShortcutsLoaderTask = new FtpShortcutsLoaderTask(); //not in the same task because this isn't using the same cursor
    mFtpShortcutsLoaderTask.execute();
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:21,代碼來源:NetworkRootFragment.java

示例5: onActivityCreated

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Just need to attach the background manager to keep the background of the parent activity
    BackgroundManager bm = BackgroundManager.getInstance(getActivity());
    bm.attach(getActivity().getWindow());
    // Adding a very dark dim to increase the difference with TvShowFragment + to improve the visibility of the row header (it contains a short how-to)
    bm.setDimLayer(getActivity().getResources().getDrawable(R.color.leanback_very_dark_dim_for_background_manager));

    setTitle(mTvshowName);
    setHeadersState(HEADERS_DISABLED);
    setHeadersTransitionOnBackEnabled(false);

    loadRows();

    setOnItemViewClickedListener(mOnItemViewClickedListener);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:19,代碼來源:MarkAsWatchedFragment.java

示例6: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    int displayModeIndex = mPrefs.getInt(PREF_ALL_MOVIES_DISPLAY_MODE, -1);
    if (displayModeIndex<0) {
        mDisplayMode = DisplayMode.GRID; // default
    } else {
        mDisplayMode = DisplayMode.values()[displayModeIndex];
    }
    mSortOrder = mPrefs.getString(SORT_PARAM_KEY, MoviesLoader.DEFAULT_SORT);
    mSortOrderEntries = MoviesSortOrderEntry.getSortOrderEntries(getActivity(), sortOrderIndexer);

    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(getResources().getColor(R.color.leanback_background));

    setTitle(getString(R.string.all_movies));
    setEmptyTextMessage(getString(R.string.you_have_no_movies));
    setOnItemViewClickedListener(new VideoViewClickedListener(getActivity()));
    setOnItemViewSelectedListener(new ItemViewSelectedListener());

    initGridOrList();
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:26,代碼來源:AllMoviesGridFragment.java

示例7: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    int displayModeIndex = mPrefs.getInt(PREF_NON_SCRAPED_VIDEOS_DISPLAY_MODE, -1);
    if (displayModeIndex < 0) {
        mDisplayMode = DisplayMode.GRID; // default
    } else {
        mDisplayMode = DisplayMode.values()[displayModeIndex];
    }
    mSortOrder = mPrefs.getString(SORT_PARAM_KEY, NonScrapedVideosLoader.DEFAULT_SORT);
    mSortOrderEntries = NonScrapedSortOrderEntry.getSortOrderEntries(getActivity(), sortOrderIndexer);

    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(getResources().getColor(R.color.leanback_background));

    setTitle(getString(R.string.non_scraped_videos));
    setEmptyTextMessage(getString(R.string.you_have_no_non_scraped_videos));
    setOnItemViewClickedListener(new VideoViewClickedListener(getActivity()));
    setOnItemViewSelectedListener(new ItemViewSelectedListener());

    initGridOrList();
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:26,代碼來源:NonScrapedVideosFragment.java

示例8: onPostExecute

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
protected void onPostExecute(File file) {
    super.onPostExecute(file);
    if(isCancelled()||mContext.isDestroyed())
        return;
    // It is on purpose that we have the error case when file is null (like a fallback)
    if (file!=null) {
        Picasso.get()
                .load(file)
                .resize(mMetrics.widthPixels, mMetrics.heightPixels)
                .error(mDefaultBackground)
                .into(mBackgroundTarget);
    }
    else {
        BackgroundManager.getInstance(mContext).setDrawable(mDefaultBackground);
    }
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:18,代碼來源:BackdropTask.java

示例9: provideOnItemViewSelectedListener

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewSelectedListener provideOnItemViewSelectedListener(final Activity activity,
        final DisplayMetrics metrics, final BackgroundManager backgroundManager,
        final RequestOptions defaultPlaceHolder, final Drawable finalDrawable, final Handler mainHandler) {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            VideoEntity selectedVideo = (VideoEntity) item;
            RunnableClass backgroundRunnable = new RunnableClass(selectedVideo, activity,
                    metrics, backgroundManager, defaultPlaceHolder, finalDrawable);

            if (lastTime != null) {
                mainHandler.removeCallbacks(lastTime);
            }
            mainHandler.postDelayed(backgroundRunnable, BACKGROUND_UPDATE_DELAY);
            lastTime = backgroundRunnable;
        }
    };
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:24,代碼來源:ListenerModule.java

示例10: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    mDorPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    mSelectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
    mDetailRowBuilderTask = (DetailRowBuilderTask) new DetailRowBuilderTask().execute(mSelectedMovie);
    mDorPresenter.setSharedElementEnterTransition(getActivity(),
            DetailsActivity.SHARED_ELEMENT_NAME);

    updateBackground(mSelectedMovie.getBackgroundImageURI());
    setOnItemViewClickedListener(new ItemViewClickedListener());

}
 
開發者ID:CesarValiente,項目名稱:tldrlegal,代碼行數:27,代碼來源:VideoDetailsFragment.java

示例11: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_manageaccounts);

    mLibrary = Library.getInstance();
    mLibrary.registerListener(this);
    mFitnessLibrary = FitnessLibrary.getInstance();
    mFitnessLibrary.registerListener(this);

    mFragmentManager = getFragmentManager();
    mBrowseFragment = (BrowseFragment) mFragmentManager.findFragmentById(R.id.id_Fragment_ManageAccountActivity);

    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
    mBrowseFragment.setBadgeDrawable(getDrawable(R.drawable.browse_logo));
    mBrowseFragment.setOnItemViewClickedListener(this);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(this);
    backgroundManager.attach(this.getWindow());
    backgroundManager.setDrawable(getResources().getDrawable(R.drawable.background, null));

    mArrayObjectAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    mBrowseFragment.setAdapter(mArrayObjectAdapter);

    updateUI();
}
 
開發者ID:mklschreiber,項目名稱:Crowdi,代碼行數:27,代碼來源:ManageAccountsActivity.java

示例12: startBackgroundTimer

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
private void startBackgroundTimer(Drawable background) {
    BackgroundManager backgroundManager = getBackgroundManager();
    if (backgroundManager == null) {
        return;
    }

    Drawable currentBackground = backgroundManager.getDrawable();
    if (currentBackground == null || currentBackground.equals(background)) {
        return;
    }

    if (backgroundTimer != null) {
        backgroundTimer.cancel();
    }

    backgroundTimer = new Timer();
    backgroundTimer.schedule(new CoreTankBackgroundTask(this, background), 300);
}
 
開發者ID:wildsmith,項目名稱:TickTank_old,代碼行數:19,代碼來源:TickTankMenuFragment.java

示例13: prepareBackgroundManager

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
private void prepareBackgroundManager() {
    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.amphitheatre);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    Picasso.with(getActivity())
            .load(R.drawable.amphitheatre)
            .resize(mMetrics.widthPixels, mMetrics.heightPixels)
            .centerCrop()
            .skipMemoryCache()
            .into(mBackgroundTarget);
}
 
開發者ID:jerrellmardis,項目名稱:Amphitheatre,代碼行數:18,代碼來源:BrowseFragment.java

示例14: onCreate

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    selectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
    new DetailRowBuilderTask().execute(selectedMovie);

    setOnItemClickedListener(getDefaultItemClickedListener());
    updateBackground(selectedMovie.getBackgroundImageURI());

}
 
開發者ID:dextorer,項目名稱:BuildingForAndroidTV,代碼行數:22,代碼來源:TVVideoDetailsFragment.java

示例15: prepareBackgroundManager

import android.support.v17.leanback.app.BackgroundManager; //導入依賴的package包/類
private void prepareBackgroundManager() {

        mBackgroundManager = BackgroundManager.getInstance(getActivity());
        mBackgroundManager.attach(getActivity().getWindow());
        mDefaultBackground = getResources().getDrawable(R.drawable.default_background);
        mMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
    }
 
開發者ID:bassaer,項目名稱:HelloTV,代碼行數:9,代碼來源:MainFragment.java


注:本文中的android.support.v17.leanback.app.BackgroundManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。