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


Java AlertDialog.findViewById方法代码示例

本文整理汇总了Java中android.app.AlertDialog.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java AlertDialog.findViewById方法的具体用法?Java AlertDialog.findViewById怎么用?Java AlertDialog.findViewById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.AlertDialog的用法示例。


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

示例1: promotionDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
private void promotionDialog(final Tuple<Integer, Integer> from, final Tuple<Integer, Integer> to) {
    LayoutInflater inflater = getLayoutInflater();
    @SuppressLint("InflateParams")
    View view = inflater.inflate(R.layout.fragment_chess_promotion_dialog, null);
    TextView title = new TextView(this);
    title.setText(R.string.game_chess_promotion_dialog_title);
    title.setBackgroundColor(Color.DKGRAY);
    title.setPadding(10, 10, 10, 10);
    title.setGravity(Gravity.CENTER);
    title.setTextColor(Color.WHITE);
    title.setTextSize(20);
    AlertDialog alertDialog = new AlertDialog.Builder(this)
            .setView(view)
            .setCustomTitle(title)
            .setCancelable(false)
            .create();
    alertDialog.show();
    ImageView queen = (ImageView) alertDialog.findViewById(R.id.promotion_queen);
    queen.setOnClickListener(new PromotionClickListener(alertDialog, from, to, 'q'));
    ImageView knight = (ImageView) alertDialog.findViewById(R.id.promotion_knight);
    knight.setOnClickListener(new PromotionClickListener(alertDialog, from, to, 'k'));
    ImageView rook = (ImageView) alertDialog.findViewById(R.id.promotion_rook);
    rook.setOnClickListener(new PromotionClickListener(alertDialog, from, to, 'r'));
    ImageView bishop = (ImageView) alertDialog.findViewById(R.id.promotion_bishop);
    bishop.setOnClickListener(new PromotionClickListener(alertDialog, from, to, 'b'));
    boolean isBlack = !board.isWhitePiece(from);
    if (isBlack) {
        queen.setImageDrawable(getDrawable(R.drawable.game_chess_queen_b));
        knight.setImageDrawable(getDrawable(R.drawable.game_chess_knight_b));
        rook.setImageDrawable(getDrawable(R.drawable.game_chess_rook_b));
        bishop.setImageDrawable(getDrawable(R.drawable.game_chess_bishop_b));
    }
}
 
开发者ID:android-gamecollection,项目名称:gamecollection,代码行数:34,代码来源:Chess.java

示例2: setTypeface

import android.app.AlertDialog; //导入方法依赖的package包/类
private static void setTypeface(TypefaceHelper helper, AlertDialog alertDialog, String typefaceName, int style) {
	Button positive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
	Button negative = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
	Button neutral = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
	TextView message = (TextView) alertDialog.findViewById(android.R.id.message);
	if (positive != null) {
		helper.setTypeface(positive, typefaceName, style);
	}
	if (negative != null) {
		helper.setTypeface(negative, typefaceName, style);
	}
	if (neutral != null) {
		helper.setTypeface(neutral, typefaceName, style);
	}
	if (message != null) {
		helper.setTypeface(message, typefaceName, style);
	}
}
 
开发者ID:geeknat,项目名称:spinify_android,代码行数:19,代码来源:DialogUtils.java

示例3: show

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Shows a popup window.
    *
 * @param title The title of the popup.
 * @param description The custom description.
 * @param context The context to show the popup in.
    * @return The popup dialog.
 */
public static AlertDialog show(String title, String description, Context context,
                           DialogInterface.OnClickListener onSubmitListener) {
       // Custom Title
    TextView customTitle = (TextView) LayoutInflater.from(context).inflate(R.layout.popup_title, null);
    customTitle.setText(title);

	AlertDialog.Builder popupBuilder = new AlertDialog.Builder(context);
	popupBuilder.setMessage(description)
	            .setNeutralButton(R.string.ok, onSubmitListener)
	            .setCustomTitle(customTitle);

	AlertDialog dialog = popupBuilder.create();
	dialog.show();

       TextView popupMessage = (TextView) dialog.findViewById(android.R.id.message);
       popupMessage.setTextColor(context.getResources().getColor(R.color.text_gray));

       Utility.setFont(FontManager.Font.ROBOTO_LIGHT, new TextView[]{
               customTitle, popupMessage
       });

       return dialog;
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:32,代码来源:Popup.java

示例4: prepareRestoreWalletDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
private void prepareRestoreWalletDialog(final Dialog dialog) {
    final AlertDialog alertDialog = (AlertDialog) dialog;

    final View replaceWarningView = alertDialog
            .findViewById(R.id.restore_wallet_from_content_dialog_replace_warning);
    final boolean hasCoins = wallet.getBalance(BalanceType.ESTIMATED).signum() > 0;
    replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE);

    final EditText passwordView = (EditText) alertDialog
            .findViewById(R.id.import_keys_from_content_dialog_password);
    passwordView.setText(null);

    final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener(
            passwordView, alertDialog) {
        @Override
        protected boolean hasFile() {
            return true;
        }
    };
    passwordView.addTextChangedListener(dialogButtonEnabler);

    final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_content_dialog_show);
    showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView));
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:25,代码来源:RestoreWalletActivity.java

示例5: ActivateReadMeDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public void ActivateReadMeDialog(Activity activity , Context context,int Language){
    AlertDialog.Builder mReadMeBuilder = new AlertDialog.Builder(activity);
    final AlertDialog mReadMeDialog =  mReadMeBuilder.create();
    mReadMeDialog.show();
    mReadMeDialog.setContentView(R.layout.read_me_layout);
    mBackButton = (Button)mReadMeDialog.findViewById(R.id.back_buttonOnReadMe);
    TextView mReadMeTextView = (TextView)mReadMeDialog.findViewById(R.id.ReadMeTextView);
    if(Language==0){mReadMeTextView.setText(activity.getResources().getString(R.string.ReadMeGrDialog));}
    else{mReadMeTextView.setText(activity.getResources().getString(R.string.ReadMeEngDialog));}
    mBackButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mReadMeDialog.cancel();
        }
    });

}
 
开发者ID:JamesNikolaidis,项目名称:Thesis_Farmers_Helper,代码行数:18,代码来源:Read_Me_Dialog.java

示例6: showAbout

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Display About dialog
 */
private void showAbout() {
    final AlertDialog dialog = showAlert(MainActivity.this,
            getString(R.string.app_name),
            R.layout.about,
            R.drawable.ic_ulogger_logo_24dp);
    final TextView versionLabel = (TextView) dialog.findViewById(R.id.about_version);
    versionLabel.setText(getString(R.string.about_version, BuildConfig.VERSION_NAME));
    final TextView descriptionLabel = (TextView) dialog.findViewById(R.id.about_description);
    final TextView description2Label = (TextView) dialog.findViewById(R.id.about_description2);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
        descriptionLabel.setText(fromHtmlDepreciated(getString(R.string.about_description)));
        description2Label.setText(fromHtmlDepreciated(getString(R.string.about_description2)));
    } else {
        descriptionLabel.setText(Html.fromHtml(getString(R.string.about_description), android.text.Html.FROM_HTML_MODE_LEGACY));
        description2Label.setText(Html.fromHtml(getString(R.string.about_description2), android.text.Html.FROM_HTML_MODE_LEGACY));
    }
    final Button okButton = (Button) dialog.findViewById(R.id.about_button_ok);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
}
 
开发者ID:bfabiszewski,项目名称:ulogger-android,代码行数:28,代码来源:MainActivity.java

示例7: changeTextDirection

import android.app.AlertDialog; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void changeTextDirection(Builder dlg){
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    dlg.create();
    AlertDialog dialog =  dlg.show();
    if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
        TextView messageview = (TextView)dialog.findViewById(android.R.id.message);
        messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
    }
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:11,代码来源:Notification.java

示例8: ReadPixelsTask

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Prepare for the glReadPixels test.
 */
public ReadPixelsTask(AlertDialog dialog, int resultTextId,
        int width, int height, int iterations) {
    mDialog = dialog;
    mResultTextId = resultTextId;
    mWidth = width;
    mHeight = height;
    mIterations = iterations;

    mProgressBar = (ProgressBar) dialog.findViewById(R.id.work_progress);
    mProgressBar.setMax(mIterations);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:15,代码来源:ReadPixelsActivity.java

示例9: TextureUploadTask

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Prepare for the glTexImage2d test.
 */
public TextureUploadTask(AlertDialog dialog, int width, int height, int iterations) {
    mDialog = dialog;
    mWidth = width;
    mHeight = height;
    mIterations = iterations;

    mProgressBar = (ProgressBar) dialog.findViewById(R.id.work_progress);
    mProgressBar.setMax(mIterations);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:13,代码来源:TextureUploadActivity.java

示例10: prepareRestoreWalletDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
private void prepareRestoreWalletDialog(final Dialog dialog) {
    final AlertDialog alertDialog = (AlertDialog) dialog;

    final String path;
    final String backupPath = Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.getAbsolutePath();
    final String storagePath = Constants.Files.EXTERNAL_STORAGE_DIR.getAbsolutePath();
    if (backupPath.startsWith(storagePath))
        path = backupPath.substring(storagePath.length());
    else
        path = backupPath;

    final List<File> files = new LinkedList<File>();

    // external storage
    final File[] externalFiles = Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.listFiles();
    if (externalFiles != null)
        for (final File file : externalFiles)
            if (Crypto.OPENSSL_FILE_FILTER.accept(file))
                files.add(file);

    // internal storage
    for (final String filename : fileList())
        if (filename.startsWith(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF + '.'))
            files.add(new File(getFilesDir(), filename));

    // sort
    Collections.sort(files, new Comparator<File>() {
        @Override
        public int compare(final File lhs, final File rhs) {
            return lhs.getName().compareToIgnoreCase(rhs.getName());
        }
    });

    final TextView messageView = (TextView) alertDialog.findViewById(R.id.restore_wallet_dialog_message);
    messageView.setText(getString(
            !files.isEmpty() ? R.string.import_keys_dialog_message : R.string.restore_wallet_dialog_message_empty,
            path));

    final Spinner fileView = (Spinner) alertDialog.findViewById(R.id.import_keys_from_storage_file);
    fileView.setVisibility(!files.isEmpty() ? View.VISIBLE : View.GONE);
    final FileAdapter adapter = (FileAdapter) fileView.getAdapter();
    adapter.setFiles(files);

    final EditText passwordView = (EditText) alertDialog.findViewById(R.id.import_keys_from_storage_password);
    passwordView.setVisibility(!files.isEmpty() ? View.VISIBLE : View.GONE);
    passwordView.setText(null);

    final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_storage_show);
    showView.setVisibility(!files.isEmpty() ? View.VISIBLE : View.GONE);
    showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView));

    final View replaceWarningView = alertDialog
            .findViewById(R.id.restore_wallet_from_storage_dialog_replace_warning);
    final boolean hasCoins = wallet.getBalance(BalanceType.ESTIMATED).signum() > 0;
    replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE);

    final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener(
            passwordView, alertDialog) {
        @Override
        protected boolean hasFile() {
            return fileView.getSelectedItem() != null;
        }

        @Override
        protected boolean needsPassword() {
            final File selectedFile = (File) fileView.getSelectedItem();
            return selectedFile != null ? Crypto.OPENSSL_FILE_FILTER.accept(selectedFile) : false;
        }
    };
    passwordView.addTextChangedListener(dialogButtonEnabler);
    fileView.setOnItemSelectedListener(dialogButtonEnabler);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:73,代码来源:WalletActivity.java

示例11: ActivateDistributerDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public void ActivateDistributerDialog(Context context, Activity activity){
    final AlertDialog mDistributerDialog;
    AlertDialog.Builder mDistributerEditor=  new AlertDialog.Builder(activity);
    mDistributerDialog = mDistributerEditor.create();
    mDistributerDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
    mDistributerDialog.show();
    mDistributerDialog.setContentView(R.layout.distributer_details_layout);
    mDistributorCompanyName =(TextView)mDistributerDialog.findViewById(R.id.DistributerNameTextView);
    mDistributorCompanyEmail = (TextView)mDistributerDialog.findViewById(R.id.DistributerEmailTextView);
    mDistributorAddress = (TextView) mDistributerDialog.findViewById(R.id.DistributerAddressTextView);
    mDistributorCompanyState = (TextView) mDistributerDialog.findViewById(R.id.DistributerStateTextView);
    mDistributorCompanyCountry = (TextView)mDistributerDialog.findViewById(R.id.DistributerCountryTextView);
    mDistributorCompanyPostal = (TextView)mDistributerDialog.findViewById(R.id.DistributerPostalTextView);
    mCloseButton = (Button)mDistributerDialog.findViewById(R.id.DistClose);
    database_class_functions = Database_Class_Functions.GetDatabaseInstance(context);

    mDistributerObject = database_class_functions.ReturnDistributerProfil();

    if(mDistributerObject==null){
        mDistributorCompanyName.setText("Nothing Found");
        mDistributorCompanyPostal.setText("Nothing Found");
        mDistributorCompanyState.setText("Nothing Found");
        mDistributorCompanyEmail.setText("Nothing Found");
        mDistributorAddress.setText("Nothing Found");
        mDistributorCompanyCountry.setText("Nothing Found");
    }else{
    mDistributorCompanyName.setText(mDistributerObject.Name);
    mDistributorCompanyPostal.setText(mDistributerObject.Postal);
    mDistributorCompanyState.setText(mDistributerObject.State);
    mDistributorCompanyEmail.setText(mDistributerObject.Email);
    mDistributorAddress.setText(mDistributerObject.Address);
    mDistributorCompanyCountry.setText(mDistributerObject.Country);
    }
    mCloseButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mDistributerDialog.cancel();
            mDistributorCompanyName.setText("Nothing Found");
            mDistributorCompanyPostal.setText("Nothing Found");
            mDistributorCompanyState.setText("Nothing Found");
            mDistributorCompanyEmail.setText("Nothing Found");
            mDistributorAddress.setText("Nothing Found");
            mDistributorCompanyCountry.setText("Nothing Found");

        }
    });


}
 
开发者ID:JamesNikolaidis,项目名称:Thesis_Farmers_Helper,代码行数:50,代码来源:View_Distributer_Details_Dialog.java

示例12: trackSummary

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Called when the user clicks the track text view
 * @param view View
 */
public void trackSummary(@SuppressWarnings("UnusedParameters") View view) {
    final TrackSummary summary = db.getTrackSummary();
    if (summary == null) {
        showToast(getString(R.string.no_positions));
        return;
    }

    final AlertDialog dialog = showAlert(MainActivity.this,
            getString(R.string.track_summary),
            R.layout.summary,
            R.drawable.ic_equalizer_white_24dp);
    final Button okButton = (Button) dialog.findViewById(R.id.summary_button_ok);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    final TextView summaryDistance = (TextView) dialog.findViewById(R.id.summary_distance);
    final TextView summaryDuration = (TextView) dialog.findViewById(R.id.summary_duration);
    final TextView summaryPositions = (TextView) dialog.findViewById(R.id.summary_positions);
    double distance = (double) summary.getDistance() / 1000;
    String unitName = getString(R.string.unit_kilometer);
    if (pref_units.equals(getString(R.string.pref_units_imperial))) {
        distance *= KM_MILE;
        unitName = getString(R.string.unit_mile);
    }
    final NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);
    final String distanceString = nf.format(distance);
    summaryDistance.setText(getString(R.string.summary_distance, distanceString, unitName));
    final long h = summary.getDuration() / 3600;
    final long m = summary.getDuration() % 3600 / 60;
    summaryDuration.setText(getString(R.string.summary_duration, h, m));
    int positionsCount = (int) summary.getPositionsCount();
    if (needsPluralFewHack(positionsCount)) {
        summaryPositions.setText(getResources().getString(R.string.summary_positions_few, positionsCount));
    } else {
        summaryPositions.setText(getResources().getQuantityString(R.plurals.summary_positions, positionsCount, positionsCount));
    }
}
 
开发者ID:bfabiszewski,项目名称:ulogger-android,代码行数:46,代码来源:MainActivity.java

示例13: setClickableLinks

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Allows hyperlinks in an alertDialog to be clicked
 * Important: Call this method AFTER showing the dialog
 *
 * @param alertDialog The dialog
 */
public static void setClickableLinks(AlertDialog alertDialog) {
    TextView message = (TextView) alertDialog.findViewById(android.R.id.message);
    setClickableLinks(message);
}
 
开发者ID:android-gamecollection,项目名称:gamecollection,代码行数:11,代码来源:TextUtils.java


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