当前位置: 首页>>代码示例>>Java>>正文


Java GravityEnum类代码示例

本文整理汇总了Java中com.afollestad.materialdialogs.GravityEnum的典型用法代码示例。如果您正苦于以下问题:Java GravityEnum类的具体用法?Java GravityEnum怎么用?Java GravityEnum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GravityEnum类属于com.afollestad.materialdialogs包,在下文中一共展示了GravityEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showStreamsDialog

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@Override
public void showStreamsDialog(List<Stream> streams) {

    MaterialDialog dialog = new MaterialDialog.Builder(this)
            .contentGravity(GravityEnum.CENTER)
            .customView(R.layout.dialog_sounds, false)
            .build();

    RecyclerView grid = (RecyclerView) dialog.getCustomView();
    if (grid != null) {
        grid.setLayoutManager(new GridLayoutManager(MainActivity.this, 2));
        gridAdapter.setData(streams, (view, position, dataSet) -> {

            presenter.streamPicked(streams.get(position));
            dialog.dismiss();
        });
        grid.setAdapter(gridAdapter);
    }

    dialog.show();
}
 
开发者ID:NielsMasdorp,项目名称:Sleeply-Android,代码行数:22,代码来源:MainActivity.java

示例2: showThemed

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@OnClick(R.id.themed) public void showThemed() {
    new MaterialDialog.Builder(this)
            .title(R.string.useGoogleLocationServices)
            .content(R.string.useGoogleLocationServicesPrompt)
            .positiveText(R.string.agree)
            .negativeText(R.string.disagree)
            .positiveColorRes(R.color.material_red_400)
            .negativeColorRes(R.color.material_red_400)
            .titleGravity(GravityEnum.CENTER)
            .titleColorRes(R.color.material_red_400)
            .contentColorRes(android.R.color.white)
            .backgroundColorRes(R.color.material_blue_grey_800)
            .dividerColorRes(R.color.accent)
            .btnSelector(R.drawable.md_btn_selector_custom, DialogAction.POSITIVE)
            .positiveColor(Color.WHITE)
            .negativeColorAttr(android.R.attr.textColorSecondaryInverse)
            .theme(Theme.DARK)
            .show();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:MainActivity.java

示例3: resolveGravityEnum

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
public static GravityEnum resolveGravityEnum(Context context,
                                             @AttrRes int attr,
                                             GravityEnum defaultGravity) {
    TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{attr});
    try {
        switch (a.getInt(0, gravityEnumToAttrInt(defaultGravity))) {
            case 1:
                return GravityEnum.CENTER;
            case 2:
                return GravityEnum.END;
            default:
                return GravityEnum.START;
        }
    } finally {
        a.recycle();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:DialogUtils.java

示例4: showLoadingView

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
/**
 * Show the loading dialog.
 *
 * @param context    the context.
 * @param stringRes  the resource id of the content.
 * @param cancelable whether this loading dialog is cancelable.
 */
public void showLoadingView(Context context, @StringRes int stringRes, boolean cancelable) {
    if (sMaterialDialog == null) {
        sMaterialDialog = new MaterialDialog.Builder(context)
                .progress(true, 0)
                .widgetColorRes(R.color.colorAccent)
                .content(stringRes)
                .backgroundColorRes(R.color.white)
                .contentGravity(GravityEnum.CENTER)
                .canceledOnTouchOutside(cancelable)
                .cancelable(cancelable)
                .build();
        sMaterialDialog.show();
    } else if (sMaterialDialog.isShowing()) {
        sMaterialDialog.setContent(stringRes);
    } else {
        sMaterialDialog.show();
    }
}
 
开发者ID:Mindjet,项目名称:LiteReader,代码行数:26,代码来源:LoadingView.java

示例5: initView

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
private void initView() {
    isConnect = SystemUtils.checkNetworkConnection(FindGankAty.this);
    mTitleBackIBtn = (ImageButton) findViewById(R.id.title_gank_back_ibtn);
    mGankClassBtn = (Button) findViewById(R.id.title_gank_class_tv);
    mRecyclerView = (RecyclerView) findViewById(R.id.find_gank_recyclerview);
    mMaterialDialog = new MaterialDialog.Builder(FindGankAty.this)
            .content("Please waiting...")
            .contentGravity(GravityEnum.CENTER)
            .progress(true, 0)
            .progressIndeterminateStyle(true)
            .show();
    mMaterialDialog.setCancelable(false);

    if (isConnect) {
        switchSelectedDatas("all");
    } else {
        mMaterialDialog.dismiss();
        SystemUtils.noNetworkAlert(FindGankAty.this);
    }
}
 
开发者ID:absentm,项目名称:myapplication,代码行数:21,代码来源:FindGankAty.java

示例6: createSorceryDialog

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
private void createSorceryDialog() {
    PhilosopherStone stone = new SorceryStone.Builder(getActivity())
            .titleColor(Color.MAGENTA)
            .titleGravity(GravityEnum.CENTER)
            .contentColor(Color.CYAN)
            .contentGravity(GravityEnum.CENTER)
            .buttonRippleColor(Color.YELLOW)
            .contentLineSpacing(2.0f)
            .theme(Theme.DARK)
            .setPhilosopherStone(new ColorPaletteStone()) // special power
            .build();

    Material.Builder builder = new Material.Builder(getActivity())
            .setTitle("Sorcery Stone")
            .setNegativeButton(android.R.string.cancel, null)
            .setPositiveButton(android.R.string.ok, null)
            .setPhilosopherStone(stone);

    DialogAlchemy.show(getFragmentManager(), builder.build(),
            new MaterialDialogsTransmutationCircle());
}
 
开发者ID:NeoLSN,项目名称:DialogAlchemy,代码行数:22,代码来源:DialogExampleFragment.java

示例7: showOtaDialog

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
private void showOtaDialog() {
    dialogOtaProcessing = new MaterialDialog.Builder(this)
            .title(R.string.popup_ota_title)
            .content(R.string.popup_ota_content)
            .contentGravity(GravityEnum.CENTER)
            .progress(false, 100, true)
            .cancelable(false)
            .showListener(new DialogInterface.OnShowListener() {
                @Override
                public void onShow(DialogInterface dialogInterface) {

                }
            }).build();

    dialogOtaProcessing.show();
}
 
开发者ID:FirstBuild,项目名称:FirstBuild-Mobile-Android-Old,代码行数:17,代码来源:ParagonMainActivity.java

示例8: showMap

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@Override
public void showMap(String location) {

    String url = Constants.STATIC_MAPS_URL_FIRST +
            location + Constants.STATIC_MAPS_URL_SECOND +
            location + Constants.STATIC_MAPS_URL_THIRD +
            mapsApiKey;

    mapDialog = new MaterialDialog.Builder(this)
            .customView(R.layout.map_image, false)
            .contentGravity(GravityEnum.CENTER)
            .build();

    View imageView = mapDialog.getCustomView();
    Picasso.with(MainActivity.this).load(url).into((ImageView) imageView);
    mapDialog.show();
}
 
开发者ID:NielsMasdorp,项目名称:Speculum-Android,代码行数:18,代码来源:MainActivity.java

示例9: onDeleteClick

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@Override
public void onDeleteClick(View view, final int position) {
    // popup to show delete
    new MaterialDialog.Builder(getActivity())
            .callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog dialog) {
                    super.onPositive(dialog);
                    // delete operatio, delete from cloud first, if succeed then delete from local
                    AsyncRemoveBookFromCloud arbfc = new AsyncRemoveBookFromCloud();
                    arbfc.execute(listNovelItemAid.get(position));
                    listNovelItemAid.remove(position);
                    refreshList(timecount ++);
                }
            })
            .theme(Theme.LIGHT)
            .content(R.string.dialog_content_want_to_delete)
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_sure)
            .negativeText(R.string.dialog_negative_preferno)
            .show();
}
 
开发者ID:MewX,项目名称:light-novel-library_Wenku8_Android,代码行数:23,代码来源:FavFragment.java

示例10: onItemLongClick

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@Override
public void onItemLongClick(View view, final int postion) {
    //Toast.makeText(this, postion + ": Long Click Detected", Toast.LENGTH_SHORT).show();
    new MaterialDialog.Builder(this)
            .callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog dialog) {
                    super.onPositive(dialog);
                    GlobalConfig.deleteSearchHistory(historyList.get(postion));
                    refreshHistoryList();
                }
            })
            .theme(Theme.LIGHT)
            .backgroundColorRes(R.color.dlgBackgroundColor)
            .contentColorRes(R.color.dlgContentColor)
            .positiveColorRes(R.color.dlgPositiveButtonColor)
            .negativeColorRes(R.color.dlgNegativeButtonColor)
            .title(getResources().getString(R.string.dialog_content_delete_one_search_record))
            .content(historyList.get(postion))
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_likethis)
            .negativeText(R.string.dialog_negative_preferno)
            .show();
}
 
开发者ID:MewX,项目名称:light-novel-library_Wenku8_Android,代码行数:25,代码来源:SearchActivity.java

示例11: showThemed

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@OnClick(R.id.themed)
public void showThemed() {
  new MaterialDialog.Builder(this)
      .title(R.string.useGoogleLocationServices)
      .content(R.string.useGoogleLocationServicesPrompt, true)
      .positiveText(R.string.agree)
      .negativeText(R.string.disagree)
      .positiveColorRes(R.color.material_red_400)
      .negativeColorRes(R.color.material_red_400)
      .titleGravity(GravityEnum.CENTER)
      .titleColorRes(R.color.material_red_400)
      .contentColorRes(android.R.color.white)
      .backgroundColorRes(R.color.material_blue_grey_800)
      .dividerColorRes(R.color.accent)
      .btnSelector(R.drawable.md_btn_selector_custom, DialogAction.POSITIVE)
      .positiveColor(Color.WHITE)
      .negativeColorAttr(android.R.attr.textColorSecondaryInverse)
      .theme(Theme.DARK)
      .show();
}
 
开发者ID:afollestad,项目名称:material-dialogs,代码行数:21,代码来源:MainActivity.java

示例12: invertGravityIfNecessary

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
private void invertGravityIfNecessary() {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
    return;
  }
  Configuration config = getResources().getConfiguration();
  if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
    switch (buttonGravity) {
      case START:
        buttonGravity = GravityEnum.END;
        break;
      case END:
        buttonGravity = GravityEnum.START;
        break;
    }
  }
}
 
开发者ID:afollestad,项目名称:material-dialogs,代码行数:17,代码来源:MDRootLayout.java

示例13: resolveGravityEnum

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
public static GravityEnum resolveGravityEnum(
    Context context, @AttrRes int attr, GravityEnum defaultGravity) {
  TypedArray a = context.getTheme().obtainStyledAttributes(new int[] {attr});
  try {
    switch (a.getInt(0, gravityEnumToAttrInt(defaultGravity))) {
      case 1:
        return GravityEnum.CENTER;
      case 2:
        return GravityEnum.END;
      default:
        return GravityEnum.START;
    }
  } finally {
    a.recycle();
  }
}
 
开发者ID:afollestad,项目名称:material-dialogs,代码行数:17,代码来源:DialogUtils.java

示例14: showStacked

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
@OnClick(R.id.stacked) public void showStacked() {
    new MaterialDialog.Builder(this)
            .title(R.string.useGoogleLocationServices)
            .content(R.string.useGoogleLocationServicesPrompt)
            .positiveText(R.string.speedBoost)
            .negativeText(R.string.noThanks)
            .btnStackedGravity(GravityEnum.END)
            .stackingBehavior(StackingBehavior.ALWAYS)  // this generally should not be forced, but is used for demo purposes
            .show();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:MainActivity.java

示例15: invertGravityIfNecessary

import com.afollestad.materialdialogs.GravityEnum; //导入依赖的package包/类
private void invertGravityIfNecessary() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return;
    Configuration config = getResources().getConfiguration();
    if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        switch (buttonGravity) {
            case START:
                buttonGravity = GravityEnum.END;
                break;
            case END:
                buttonGravity = GravityEnum.START;
                break;
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:MDRootLayout.java


注:本文中的com.afollestad.materialdialogs.GravityEnum类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。