當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。