android.support.wearable.view.CardFragment Java Examples

The following examples show how to use android.support.wearable.view.CardFragment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElementGridPagerAdapter.java    From TutosAndroidFrance with MIT License 6 votes vote down vote up
public ElementGridPagerAdapter(Context context, List<AndroidVersion> androidVersions, FragmentManager fm) {
    super(fm);

    this.context = context;
    this.androidVersions = androidVersions;
    this.mRows = new ArrayList<Row>();

    //Construit le tableau des éléménts à afficher
    for (AndroidVersion version : androidVersions) {
        mRows.add(new Row(
                        //pour l'instant nous ne mettrons qu'un élément par ligne
                        CardFragment.create(version.getTitre(), version.getDescription())
                )
        );
    }
}
 
Example #2
Source File: ElementGridPagerAdapter.java    From WearMenu with Apache License 2.0 6 votes vote down vote up
public ElementGridPagerAdapter(Context context, List<Element> elements, FragmentManager fm) {
    super(fm);

    this.mContext = context;
    this.mRows = new ArrayList<>();
    this.mElement = elements;

    this.mBackgroundDrawable = mContext.getResources().getDrawable(R.drawable.wearmenu_background);

    //Construit le tableau des éléménts à afficher
    for (Element element : elements) {
        mRows.add(new Row(
                        //pour l'instant nous ne mettrons qu'un élément par ligne
                        CardFragment.create(element.getTitre(), element.getTexte()),
                        createActionFragment(),
                        createActionFragment()
                )
        );
    }
}
 
Example #3
Source File: ElementGridPagerAdapter.java    From WearViewStub with Apache License 2.0 6 votes vote down vote up
public ElementGridPagerAdapter(List<Element> elements, FragmentManager fm) {
    super(fm);

    this.mRows = new ArrayList<>();
    this.mElement = elements;

    //Construit le tableau des éléménts à afficher
    for (Element element : elements) {
        mRows.add(new Row(
                        //pour l'instant nous ne mettrons qu'un élément par ligne
                        createElementFragment(),
                        CardFragment.create(element.getTitre(), element.getTexte()),
                        createActionFragment(),
                        createActionFragment()
                )
        );
    }
}
 
Example #4
Source File: ElementGridPagerAdapter.java    From TutosAndroidFrance with MIT License 5 votes vote down vote up
public ElementGridPagerAdapter(List<Element> elements, FragmentManager fm) {
    super(fm);

    this.mRows = new ArrayList<Row>();

    //Construit le tableau des éléménts à afficher
    for (Element element : elements) {
        mRows.add(new Row(
                        //pour l'instant nous ne mettrons qu'un élément par ligne
                        CardFragment.create(element.getTitre(), element.getTexte())
                )
        );
    }
}
 
Example #5
Source File: ElementGridPagerAdapter.java    From DaVinci with Apache License 2.0 5 votes vote down vote up
public ElementGridPagerAdapter(Context context, List<Element> elements, FragmentManager fm) {
    super(fm);

    this.mContext = context;
    this.mRows = new ArrayList<Row>();
    this.elementList = new ArrayList<>(elements);

    for (Element element : elementList) {
        mRows.add(new Row(
                        CardFragment.create(element.getTitle(), element.getText())
                )
        );
    }
}
 
Example #6
Source File: SampleGridPagerAdapter.java    From android-GridViewPager with Apache License 2.0 5 votes vote down vote up
private Fragment cardFragment(int titleRes, int textRes) {
    Resources res = mContext.getResources();
    CardFragment fragment =
            CardFragment.create(res.getText(titleRes), res.getText(textRes));
    // Add some extra bottom margin to leave room for the page indicator
    fragment.setCardMarginBottom(
            res.getDimensionPixelSize(R.dimen.card_margin_bottom));
    return fragment;
}
 
Example #7
Source File: SampleGridPagerAdapter.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
@Override
public Fragment getFragment(int row, int col) {
    Page page = PAGES[row][col];
    String title = page.titleRes != 0 ? mContext.getString(page.titleRes) : null;
    String text = page.textRes != 0 ? mContext.getString(page.textRes) : null;
    CardFragment fragment = CardFragment.create(title, text, page.iconRes);
    // Advanced settings
    fragment.setCardGravity(page.cardGravity);
    fragment.setExpansionEnabled(page.expansionEnabled);
    fragment.setExpansionDirection(page.expansionDirection);
    fragment.setExpansionFactor(page.expansionFactor);
    return fragment;
}
 
Example #8
Source File: GridExampleActivity.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
private static MainFragment newInstance(int rowNum, int colNum) {
    Bundle args = new Bundle();
    args.putString(CardFragment.KEY_TITLE, "Row:" + rowNum);
    args.putString(CardFragment.KEY_TEXT, "Col:" + colNum);
    MainFragment f = new MainFragment();
    f.setArguments(args);
    return f;
}
 
Example #9
Source File: GridExampleActivity.java    From android-SkeletonWearableApp with Apache License 2.0 5 votes vote down vote up
private static MainFragment newInstance(int rowNum, int colNum) {
    Bundle args = new Bundle();
    args.putString(CardFragment.KEY_TITLE, "Row:" + rowNum);
    args.putString(CardFragment.KEY_TEXT, "Col:" + colNum);
    MainFragment f = new MainFragment();
    f.setArguments(args);
    return f;
}
 
Example #10
Source File: CommentsGridPagerAdapter.java    From wear-notify-for-reddit with Apache License 2.0 5 votes vote down vote up
private Fragment cardFragment(Comment p) {
    CardFragment fragment = RedditCommentCardFragment.create(p);
    // Add some extra bottom margin to leave room for the page indicator
    fragment.setCardMarginBottom(mContext.getResources()
            .getDimensionPixelSize(R.dimen.card_margin_bottom));
    return fragment;
}
 
Example #11
Source File: RedditCommentCardFragment.java    From wear-notify-for-reddit with Apache License 2.0 5 votes vote down vote up
public static CardFragment create(Comment comment) {
    Bundle args = new Bundle();
    args.putString(ARGS_KEY_TITLE, comment.getAuthor());
    args.putString(ARGS_KEY_TEXT, comment.getPostContents());
    args.putBoolean(ARGS_KEY_SCORE_HIDDEN, comment.isScoreHidden());
    args.putInt(ARGS_KEY_SCORE, comment.getScore());
    args.putInt(ARGS_KEY_GILDED, comment.getGilded());
    args.putInt(ARGS_KEY_REPLY_LEVEL, comment.getReplyLevel());

    RedditCommentCardFragment fragment = new RedditCommentCardFragment();
    fragment.setArguments(args);
    return fragment;
}