Java 类android.widget.Toast 实例源码

项目:android-dev-challenge    文件:SettingsFragment.java   
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    Toast error = Toast.makeText(getContext(), "Please select a number between 0.1 and 3", Toast.LENGTH_SHORT);

    String sizeKey = getString(R.string.pref_size_key);
    if (preference.getKey().equals(sizeKey)) {
        String stringSize = ((String) newValue).trim();

        try {
            float size = Float.parseFloat(stringSize);
            if (size > 3 || size <= 0.1) {
                error.show();
                return false;
            }
        } catch (NumberFormatException nfe) {
            error.show();
            return false;
        }
    }
    return true;
}
项目:Paathshala    文件:LoginActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            // Google Sign In was successful, authenticate with Firebase
            GoogleSignInAccount account = result.getSignInAccount();
            //mStatusTextView.setText(getString(R.string.signed_in_fmt, acct.getDisplayName()));
            firebaseAuthWithGoogle(account);
        } else {
            // Google Sign In failed, update UI appropriately
            // [START_EXCLUDE]
            //updateUI(null);
            // [END_EXCLUDE]
            Toast.makeText(LoginActivity.this, "Authentication failed.",
                    Toast.LENGTH_SHORT).show();
        }
    }
}
项目:BalaFM    文件:PersonFragment.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode){
        case PERSON_INFO_SETTING_CODE:
            switch (resultCode){
                case RESULT_OK:
                    init();
                    return;
            }
            break;
        case USER_SAFE_CODE:
            break;
        case REPORT_QUESTIONG_CODE:
            Toast.makeText(getActivity(),"感谢您的建议~~",Toast.LENGTH_SHORT).show();
            break;
        case PERSON_LOGIN_CODE:
            if (AppKt.getGlobalUid() == 0) {
                Toast.makeText(getActivity(), "未登陆", Toast.LENGTH_LONG).show();
            }
            break;
    }
    return;
}
项目:decoy    文件:AdvancedTeamMemberInfoActivity.java   
/**
 * 更新群昵称
 *
 * @param name
 */
private void setNickname(final String name) {
    DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
    NIMClient.getService(TeamService.class).updateMemberNick(teamId, account, name).setCallback(new RequestCallback<Void>() {
        @Override
        public void onSuccess(Void param) {
            DialogMaker.dismissProgressDialog();
            nickName.setText(name != null ? name : getString(R.string.team_nickname_none));
            Toast.makeText(AdvancedTeamMemberInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onFailed(int code) {
            DialogMaker.dismissProgressDialog();
            Toast.makeText(AdvancedTeamMemberInfoActivity.this, String.format(getString(R.string.update_failed), code),
                    Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onException(Throwable exception) {
            DialogMaker.dismissProgressDialog();
        }
    });
}
项目:KTools    文件:ToastUtils.java   
public static void showToast(String msg, int duration) {
    final Timer timer = new Timer();
    final Toast toast = Toast.makeText(King.getApplicationContext(), msg, Toast.LENGTH_LONG);
    timer.schedule(new TimerTask() {
        @Override
        public void run() {
            toast.show();
        }
    }, 0, 1000);

    new Timer().schedule(new TimerTask() {
        @Override
        public void run() {
            toast.cancel();
            timer.cancel();
        }
    }, duration);

}
项目:decoy    文件:AdvancedTeamInfoActivity.java   
/**
 * 更新群信息
 *
 * @param t
 */
private void updateTeamInfo(final Team t) {
    this.team = t;

    if (team == null) {
        Toast.makeText(this, getString(R.string.team_not_exist), Toast.LENGTH_SHORT).show();
        finish();
        return;
    } else {
        creator = team.getCreator();
        if (creator.equals(NimUIKit.getAccount())) {
            isSelfAdmin = true;
        }

        setTitle(team.getName());
    }

    teamHeadImage.loadTeamIconByTeam(team);
    teamNameText.setText(team.getName());
    teamIdText.setText(team.getId());
    teamCreateTimeText.setText(TimeUtil.getTimeShowString(team.getCreateTime(), true));

    ((TextView) layoutTeamName.findViewById(R.id.item_detail)).setText(team.getName());
    introduceEdit.setText(team.getIntroduce());
    extensionTextView.setText(team.getExtension());
    notificationConfigText.setText(team.mute() ? "关闭" : "开启");
    memberCountText.setText(String.format("共%d人", team.getMemberCount()));

    setAnnouncement(team.getAnnouncement());
    setAuthenticationText(team.getVerifyType());
    updateInviteText(team.getTeamInviteMode());
    updateInfoUpateText(team.getTeamUpdateMode());
    updateBeInvitedText(team.getTeamBeInviteMode());
}
项目:GitHub    文件:DetailsFragment.java   
@Override public void onClick(View v) {
  if (mail != null) {
    presenter.starMail(mail, !mail.isStarred());
  } else {
    Toast.makeText(getActivity(), R.string.error_wait_mail_loaded, Toast.LENGTH_SHORT).show();
  }
}
项目:ChewSnap    文件:LoginActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_SIGNUP) {
        if (resultCode == RESULT_OK) {

            // TODO: Implement successful signup logic here
            // By default we just finish the Activity and log them in automatically
            Toast.makeText(getBaseContext(), "Welcome to ChewSnap!", Toast.LENGTH_LONG).show();
            onLoginSuccess();
            //this.finish();
        }
    }
}
项目:ucar-weex-core    文件:WXDebugActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if (result != null) {
        if (result.getContents() == null) {
            Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
        } else {
            handleDecodeInternally(result.getContents());
        }
    }
    super.onActivityResult(requestCode, resultCode, data);
}
项目:SmartisanDialog    文件:MainActivity.java   
/**
 * 带单选按钮的Dialog
 *
 * @param view
 */
public void singleChoiceDialog(View view) {
    final SingleChoiceDialog dialog = SmartisanDialog.createSingleChoiceDialog(this);
    dialog.setTitle("蜂窝移动数据")
        .setLeftBtnText("取消")
        .setSingleChoiceItems(new String[]{"关", "使用 SIM 卡 1", "使用 SIM 卡 2"}, 0)
        .show();
    dialog.setOnSingleChoiceSelectListener(new OnSingleChoiceSelectListener() {
        @Override
        public void onSelect(int position) {
            Toast.makeText(MainActivity.this, "position = " + position, Toast.LENGTH_SHORT).show();
            dialog.dismiss();
        }
    });
    dialog.setOnBtnSelectListener(new SingleChoiceDialog.OnBtnSelectListener() {
        @Override
        public void onLeftSelect() {
            dialog.dismiss();
        }

        @Override
        public void onRightSelect() {

        }
    });
}
项目:USay    文件:UpdatePasswordActivity.java   
private void updatePasswordClickEvent() {
    mUpdateCompile.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            oldPaw = mUpdateOldPassword.getText().toString().trim();
            newPaw = mUpdateNewPassword.getText().toString().trim();

            if (TextUtils.isEmpty(oldPaw)) {
                Toast.makeText(UpdatePasswordActivity.this, "请输入旧密码!", Toast.LENGTH_SHORT).show();
            } else if (TextUtils.isEmpty(newPaw)) {
                Toast.makeText(UpdatePasswordActivity.this, "请输入新密码!", Toast.LENGTH_SHORT).show();
            } else {
                if (mMyUser != null) {
                    MyUser.updateCurrentUserPassword(oldPaw, newPaw, new UpdateListener() {
                        @Override
                        public void done(BmobException e) {
                            if (e == null) {
                                PersonSettingActivity.sSettingActivity.finishAfterTransition();
                                Toast.makeText(UpdatePasswordActivity.this,
                                        "修改成功,请用新密码登录!", Toast.LENGTH_SHORT).show();
                                Intent intent = new Intent(UpdatePasswordActivity.this,
                                        LoginActivity.class);
                                startActivity(intent);
                                finishAfterTransition();
                            } else {
                                Toast.makeText(UpdatePasswordActivity.this,
                                        "修改失败,请重新检查!", Toast.LENGTH_SHORT).show();
                            }
                        }
                    });
                }
            }
        }
    });
}
项目:android-radiobutton-extended    文件:MainActivity.java   
@Override
public <V extends View & Checkable> void onCheckedChange(ExampleViewHolder vh, V view, boolean isChecked) {
    if (view.isPressed()) {
        Toast.makeText(
                MainActivity.this,
                String.format(
                        "position=%d; label=%s; isChecked=%b;",
                        vh.getAdapterPosition(),
                        vh.getRadioButton().getText(),
                        isChecked
                ),
                Toast.LENGTH_SHORT
        ).show();
    }
}
项目:polling-station-app    文件:PassportConActivity.java   
/**
 * Method to start the ResultActivity once all the data is loaded.
 * Creates new intent with the read data
 * @param pubKey The public key.
 * @param signedTransactions Signed data.
 * @param voter The voter.
 */
public void startResultActivity(PublicKey pubKey, ArrayList<byte[]> signedTransactions, Voter voter) {
    if(pubKey != null && signedTransactions != null) {

        Intent intent = new Intent(getApplicationContext(), ResultActivity.class);
        intent.putExtra("voter", voter);
        intent.putExtra("pubKey", pubKey);
        intent.putExtra("signedTransactions", signedTransactions);
        startActivity(intent);
        finish();
    } else {
        Toast.makeText(this, getString(R.string.NFC_error), Toast.LENGTH_LONG).show();
        progressView.setImageResource(R.drawable.nfc_icon_empty);
    }
}
项目:CatchSpy    文件:ImportActivity.java   
private void advancedImportDialog(Context context) {
    LayoutInflater inflater = getLayoutInflater();
    View mView = inflater.inflate(R.layout.dialog_advanced_import, (ViewGroup) findViewById(R.id.dialog_layout_import_advanced));
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.import_advanced);
    final TextInputEditText group = mView.findViewById(R.id.edittext_import_advanced_group);
    final TextInputEditText word = mView.findViewById(R.id.edittext_import_advanced_word);
    final CheckBox ignoreChangeLine = mView.findViewById(R.id.checkbox_import_advanced_ignore_change_line);
    builder.setPositiveButton(R.string.import_file, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String groupReg = group.getText().toString();
            String wordReg = word.getText().toString();
            if (!groupReg.isEmpty()) {
                if (!wordReg.isEmpty()) {
                    int result = ImportMethod.extraFileRegImporter(DictionaryPath, DictionaryName, groupReg, wordReg, ignoreChangeLine.isChecked());
                    if (result == Config.IMPORT_OK) {
                        Toast.makeText(ImportActivity.this, R.string.import_success, Toast.LENGTH_SHORT).show();
                        finish();
                    } else if (result == Config.IMPORT_FILE_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content), R.string.import_file_error, Snackbar.LENGTH_SHORT).show();
                    } else if (result == Config.IMPORT_OUTPUT_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content), R.string.import_output_error, Snackbar.LENGTH_SHORT).show();
                    } else if (result == Config.IMPORT_GROUP_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content), R.string.import_advanced_group_match_error, Snackbar.LENGTH_SHORT).show();
                    } else if (result == Config.IMPORT_WORDS_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content), R.string.import_advanced_word_match_error, Snackbar.LENGTH_SHORT).show();
                    }
                } else {
                    Snackbar.make(findViewById(R.id.import_layout_content), R.string.import_advanced_word_match_error, Snackbar.LENGTH_SHORT).show();
                }
            } else {
                Snackbar.make(findViewById(R.id.import_layout_content), R.string.import_advanced_group_match_error, Snackbar.LENGTH_SHORT).show();
            }
        }
    });
    builder.setNegativeButton(android.R.string.no, null);
    builder.setView(mView);
    builder.show();
}
项目:FancyToast-Android    文件:FancyToast.java   
public static Toast makeText(Context context,String message,int duration,int type,boolean androidicon){
    Toast toast = new Toast(context);
    toast.setDuration(duration);
    View layout = LayoutInflater.from(context).inflate(R.layout.fancytoast_layout, null, false);
    TextView l1 = (TextView) layout.findViewById(R.id.toast_text);
    LinearLayout linearLayout=(LinearLayout) layout.findViewById(R.id.toast_type);
    ImageView img=(ImageView) layout.findViewById(R.id.toast_icon);
    ImageView img1=(ImageView) layout.findViewById(R.id.imageView4);
    l1.setText(message);
    if(androidicon==true)
    img1.setVisibility(View.VISIBLE);
    else if(androidicon==false)
    img1.setVisibility(View.GONE);
    if(type==1)
    { linearLayout.setBackgroundResource(R.drawable.success_shape);
      img.setImageResource(R.drawable.ic_check_black_24dp);
    }
    else if (type==2)
    { linearLayout.setBackgroundResource(R.drawable.warning_shape);
      img.setImageResource(R.drawable.ic_pan_tool_black_24dp);
    }
    else if (type==3)
    { linearLayout.setBackgroundResource(R.drawable.error_shape);
      img.setImageResource(R.drawable.ic_clear_black_24dp);
    }
    else if (type==4)
    { linearLayout.setBackgroundResource(R.drawable.info_shape);
      img.setImageResource(R.drawable.ic_info_outline_black_24dp);
    }
    else if (type==5)
    { linearLayout.setBackgroundResource(R.drawable.default_shape);
      img.setVisibility(View.GONE);
    }
    else if (type==6)
    { linearLayout.setBackgroundResource(R.drawable.confusing_shape);
      img.setImageResource(R.drawable.ic_refresh_black_24dp);
    }
    toast.setView(layout);
    return toast;
}
项目:My-Sheep    文件:KidDetail.java   
private void visitHistoryDialog(){
    AlertDialog.Builder visitHistoryBuilder = new AlertDialog.Builder(KidDetail.this);
    visitHistoryBuilder.setCancelable(true);
    LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
    View view = inflater.inflate(R.layout.visit_history,null);
    visitHistoryBuilder.setView(view);
    final TextView historyText = (TextView) view.findViewById(R.id.historyText);
    final StringBuilder historyString = new StringBuilder();
    ParseQuery<Visit> query = ParseQuery.getQuery(Visit.class);//.fromLocalDatastore();
    query.whereContains("kidId",myKid.getObjectId());
    query.orderByAscending("createdAt");
    query.findInBackground(new FindCallback<Visit>() {
        @Override
        public void done(@NonNull List<Visit> list, @Nullable ParseException e) {
            if (e == null){
                if(list.size()!=0){
                for (int i = 0; i < list.size() ; i++) {
                    Visit visit = list.get(i);
                    historyString.append("Visit No. : "+ (i+1)+"\n");
                    historyString.append("Visit Date: "+visit.getVisitDate()+"\n");
                    historyString.append("Servants:\n "+visit.getServants()+"\n");
                    historyString.append("Visit summary:\n "+visit.getSummary()+"\n\n\n");
                    }
                    historyText.setText(historyString);
                }else{
                    historyText.setText("No visit history found!\nPlease pay a visit asap.");
                }

            }else{Toast.makeText(getApplicationContext(),"Error!",Toast.LENGTH_LONG).show();}
        }
    });

    AlertDialog historyDialog = visitHistoryBuilder.create();
    historyDialog.show();
}
项目:lockit    文件:BaseFragment.java   
private void genericError(final Throwable throwable) {
    Logger.logError(throwable);

    if (isAuthError(throwable)) {
        showUnauthorizedDialog();
        return;
    }

    String errorMessage =
            isNetworkError(throwable) ? "Network error" : "Some error occurred. Try again.";
    if (getActivity() != null) {
        Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_LONG).show();
        hideLoader();
    }
}
项目:GCSApp    文件:PayUnionStart.java   
void toast(final String str) {
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(context,str,Toast.LENGTH_SHORT).show();
        }
    });
}
项目:LuaViewPlayground    文件:ToastUtil.java   
/**
 * show a toast using resource Globals.getId()
 *
 * @param context
 * @param resId
 * @param isLong
 */
public static void showToast(final Context context, final int resId, final boolean isLong) {
    if (isLong) {
        LENGTH = Toast.LENGTH_LONG;
    } else {
        LENGTH = Toast.LENGTH_SHORT;
    }
    showToast(context, context.getString(resId));
}
项目:yass-android    文件:MainActivity.java   
@Override
protected void onPostExecute(File file) {
    super.onPostExecute(file);
    if (dialog != null) {
        dialog.dismiss();
    }

    if (file == null) {
        Toast.makeText(MainActivity.this, "Could not download file", Toast.LENGTH_LONG).show();
        return;
    }

    Uri uri = FileProvider.getUriForFile(MainActivity.this, "org.gaul.yass", file);
    String mime = object.getObjectMetadata().getContentType();

    if (mime == null) {
        int index = object.getKey().lastIndexOf('.');
        if (index != -1) {
            mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
                    object.getKey().substring(index + 1));
            Log.d(TAG, "guessed mime type: " + mime);
        }
    }

    // TODO: does not work for HTML
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(uri, mime);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    try {
        startActivity(intent);
    } catch (ActivityNotFoundException anfe) {
        // TODO: convert to text/plain?
        Log.e(TAG, "No intent for " + object.getKey() + " " + anfe);
        Toast.makeText(MainActivity.this, "No registered intent", Toast.LENGTH_LONG).show();
        return;
    }
}
项目:Android-Code-Demos    文件:RegionClickView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            int x = (int) event.getX();
            int y = (int) event.getY();

            if (mCircleRegion.contains(x, y)) {
                Toast.makeText(mCurrentContext, "Click", Toast.LENGTH_SHORT).show();
            }
            break;
    }
    return true;
}
项目:FinalProject    文件:MessageActivity.java   
@Override
public void onClick(View v) {
    switch (v.getId()){
        case R.id.chat_image:
            changeProfileRequest();
            break;
        case R.id.main_activity_emoji:
            emojiPopup.toggle();
            break;
        case R.id.emoji_send_message:
            if (editText.getText().toString().trim().isEmpty()){
                Toast.makeText(MessageActivity.this, "Please enter some message", Toast.LENGTH_SHORT).show();
            } else {

                sendTextMessage();
            }
            break;

    }
}
项目:CacheManage    文件:MainActivity.java   
private void initObserver() {
    CacheObserver.getInstance().addObserver("key1", new IDataChangeListener() {
        @Override
        public void onDataChange(String key, String str) {
            Toast.makeText(MainActivity.this, str, Toast.LENGTH_SHORT).show();
            Gson gson = new Gson();
            Test test = gson.fromJson(str, Test.class);
        }
    });
}
项目:SimpleUILauncher    文件:Launcher.java   
public boolean startActivitySafely(View v, Intent intent, ItemInfo item) {
    if (mIsSafeModeEnabled && !Utilities.isSystemApp(this, intent)) {
        Toast.makeText(this, R.string.safemode_shortcut_error, Toast.LENGTH_SHORT).show();
        return false;
    }
    // Only launch using the new animation if the shortcut has not opted out (this is a
    // private contract between launcher and may be ignored in the future).
    boolean useLaunchAnimation = (v != null) &&
            !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
    Bundle optsBundle = useLaunchAnimation ? getActivityLaunchOptions(v) : null;

    UserHandleCompat user = null;
    if (intent.hasExtra(AppInfo.EXTRA_PROFILE)) {
        long serialNumber = intent.getLongExtra(AppInfo.EXTRA_PROFILE, -1);
        user = UserManagerCompat.getInstance(this).getUserForSerialNumber(serialNumber);
    }

    // Prepare intent
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (v != null) {
        intent.setSourceBounds(getViewBounds(v));
    }
    try {
        if (Utilities.ATLEAST_MARSHMALLOW && item != null
                && (item.itemType == Favorites.ITEM_TYPE_SHORTCUT
                || item.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT)
                && ((ShortcutInfo) item).promisedIntent == null) {
            // Shortcuts need some special checks due to legacy reasons.
            startShortcutIntentSafely(intent, optsBundle, item);
        } else if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
            // Could be launching some bookkeeping activity
            startActivity(intent, optsBundle);
        } else {
            LauncherAppsCompat.getInstance(this).startActivityForProfile(
                    intent.getComponent(), user, intent.getSourceBounds(), optsBundle);
        }
        return true;
    } catch (ActivityNotFoundException|SecurityException e) {
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
        Log.e(TAG, "Unable to launch. tag=" + item + " intent=" + intent, e);
    }
    return false;
}
项目:SmartisanDialog    文件:MainActivity.java   
/**
 * 警告Dialog
 *
 * @param view
 */
public void warningDialog(View view) {
    final WarningDialog dialog = SmartisanDialog.createWarningDialog(this);
    dialog.setTitle("确定退出登录吗")
        .setConfirmText("退出登录")
        .show();
    dialog.setOnConfirmListener(new WarningDialog.OnConfirmListener() {
        @Override
        public void onConfirm() {
            Toast.makeText(MainActivity.this, "onConfirm", Toast.LENGTH_SHORT).show();
            dialog.dismiss();
        }
    });
}
项目:Runnest    文件:ChallengeActivity.java   
/**
 * Handle request permissions result. Update what is needed and give a feedback to the user.
 *
 * @param requestCode       Code of the request.
 * @param permissions       Requested permissions.
 * @param grantResults      Result of the request.
 */
@Override
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String[] permissions,
                                       @NonNull int[] grantResults)
{
    switch (requestCode) {
        case PERMISSION_REQUEST_CODE_FINE_LOCATION:
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                Toast.makeText(getApplicationContext(), R.string.toast_start_challenge,Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), R.string.toast_start_challenge_denied,
                        Toast.LENGTH_LONG).show();
            }
            break;
    }
}
项目:techstar-shop    文件:ActivitySignup.java   
public void signup() {
    if (!validate()) {
        onSignupFailed();
        return;
    }
    signUpButton.setEnabled(false);
    final ProgressDialog progressDialog = new ProgressDialog(ActivitySignup.this,
            R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage(getString(R.string.register_loaging));
    progressDialog.show();

    new android.os.Handler().postDelayed(
            new Runnable() {
                public void run() {

                    Toast.makeText(getBaseContext(), getString(R.string.register_success), Toast.LENGTH_LONG).show();
                    String name = nameEditText.getText().toString();
                    String email = emailEditText.getText().toString();
                    String password = passwordEditText.getText().toString();

                    register(name,password,email, bitmap);
                    progressDialog.dismiss();
                    finish();
                }
            }, 3000);
}
项目:Cable-Android    文件:VerifyIdentityActivity.java   
private void handleShare(@NonNull Fingerprint fingerprint, int segmentCount) {
  String shareString =
      getString(R.string.VerifyIdentityActivity_our_signal_safety_number) + "\n" +
          getFormattedSafetyNumbers(fingerprint, segmentCount) + "\n";

  Intent intent = new Intent();
  intent.setAction(Intent.ACTION_SEND);
  intent.putExtra(Intent.EXTRA_TEXT, shareString);
  intent.setType("text/plain");

  try {
    startActivity(Intent.createChooser(intent, getString(R.string.VerifyIdentityActivity_share_safety_number_via)));
  } catch (ActivityNotFoundException e) {
    Toast.makeText(getActivity(), R.string.VerifyIdentityActivity_no_app_to_share_to, Toast.LENGTH_LONG).show();
  }
}
项目:buildAPKsSamples    文件:BasicManagedProfileFragment.java   
/**
 * Clears restrictions to Chrome
 */
private void clearChromeRestrictions() {
    final Activity activity = getActivity();
    if (null == activity) {
        return;
    }
    final DevicePolicyManager manager =
            (DevicePolicyManager) activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
    // In order to clear restrictions, pass null as the restriction Bundle for
    // setApplicationRestrictions
    manager.setApplicationRestrictions
            (BasicDeviceAdminReceiver.getComponentName(activity),
                    PACKAGE_NAME_CHROME, null);
    Toast.makeText(activity, R.string.cleared, Toast.LENGTH_SHORT).show();
}
项目:Mix    文件:DaggerMainActivity.java   
private boolean isEmptyWord(String input, boolean withEmptyPoint) {
    if (TextUtils.isEmpty(input)) {
        if (withEmptyPoint) {
            Toast.makeText(DaggerMainActivity.this, "请输入日期", Toast.LENGTH_SHORT).show();
        }
        return true;
    }
    return false;
}
项目:Android-LSS    文件:StreamingActivity.java   
public void onClickQuit(View v) {
    if (isSessionStarted || isConnecting) {
        Toast.makeText(this, "直播过程中不能返回,请先停止直播!", Toast.LENGTH_SHORT).show();
    } else {
        // 提前让surface自动销毁,防止后续的慢销毁可能带来的兼容问题
        if (mCameraView != null) {
            mCameraView.setVisibility(View.INVISIBLE);
        }
        this.finish();
    }
}
项目:anitrend-app    文件:UserProfileActivity.java   
@Override
protected void startInit() {
    if(mCurrentUser != null) {
        user_anime_time.setText(mPresenter.getAnimeTime(mCurrentUser.getAnime_time()));
        user_manga_chap.setText(mCurrentUser.getManga_chap());
        user_anime_total.setText("0");
        user_manga_total.setText("0");

        UserStats userStats = mCurrentUser.getStats();
        if(userStats != null) {
            if(userStats.getStatus_distribution() != null)
                if(userStats.getStatus_distribution().getAnime() != null)
                    user_anime_total.setText(userStats.getStatus_distribution().getAnime().getTotalAnime());
            if(userStats.getStatus_distribution().getManga() != null)
                user_manga_total.setText(userStats.getStatus_distribution().getManga().getTotalManga());
        }

        Glide.with(this)
                .load(mCurrentUser.getImage_url_banner())
                .centerCrop()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(user_banner);

        updateUI();
    } else{
        Toast.makeText(this, R.string.text_error_request, Toast.LENGTH_LONG).show();
    }
}
项目:notify-me    文件:TextToSpeech.java   
void readNotification(String text) {
    if (sTextToSpeech == null) return;

    int speak = sTextToSpeech.speak(text, android.speech.tts.TextToSpeech.QUEUE_FLUSH,
            null, "111");

    if (speak < 0) {
        Toast.makeText(mContext, "Unable to speak!", Toast.LENGTH_SHORT).show();
        Log.e(TAG, "readNotification: Unable to speak!");
    }
}
项目:GCSApp    文件:UserProfileActivity.java   
private void uploadUserAvatar(final byte[] data) {
    dialog = ProgressDialog.show(this, getString(R.string.dl_update_photo), getString(R.string.dl_waiting));
    new Thread(new Runnable() {

        @Override
        public void run() {
            final String avatarUrl = DemoHelper.getInstance().getUserProfileManager().uploadUserAvatar(data);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    dialog.dismiss();
                    if (avatarUrl != null) {
                        Toast.makeText(UserProfileActivity.this, getString(R.string.toast_updatephoto_success),
                                Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(UserProfileActivity.this, getString(R.string.toast_updatephoto_fail),
                                Toast.LENGTH_SHORT).show();
                    }

                }
            });

        }
    }).start();

    dialog.show();
}
项目:Shared-Route    文件:PayBillActivity.java   
@Override
        protected void onPostExecute(final Boolean success) {
            mAuthTask = null;
            showProgress(false);

            if (success) {
                new AlertDialog.Builder(PayBillActivity.this)
                        .setIcon(R.drawable.share_icon_with_background)//这里是显示提示框的图片信息,我这里使用的默认androidApp的图标
                        .setTitle("支付成功")
                        .setMessage("即将返回主页")
                        .setPositiveButton("确认", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                startActivity(new Intent(PayBillActivity.this, MainActivity.class));
                                finish();
                            }
                        }).show();
//                Toast.makeText(getApplicationContext(),"支付成功,即将返回主页!", Toast.LENGTH_SHORT).show();
//                Thread thread = new Thread() {
//                    public void run(){
//                        try {
//                            Thread.sleep(2000);
//                        } catch (InterruptedException e) {
//                            e.printStackTrace();
//                        }
//                        startActivity(new Intent(PayBillActivity.this,MainActivity.class));
//                        finish();
//                    }
//                };
//                thread.start();
            }
            else
            {
                Toast.makeText(getApplicationContext(),result.toString(), Toast.LENGTH_SHORT).show();
            }
        }
项目:TaipeiTechRefined    文件:Utility.java   
public static boolean checkAccount(Context context) {
    String account = Model.getInstance().getAccount();
    String password = Model.getInstance().getPassword();
    if (TextUtils.isEmpty(account) || TextUtils.isEmpty(password)) {
        Toast.makeText(context, R.string.account_password_empty_toast_text, Toast.LENGTH_LONG).show();
        return false;
    }
    return true;
}
项目:javaide    文件:EditorFragment.java   
@Override
public void redo() {
    if (mCodeEditor == null) return;
    if (mCodeEditor.canRedo()) {
        mCodeEditor.redo();
    } else {
        Toast.makeText(getContext(), R.string.cant_redo, Toast.LENGTH_SHORT).show();
    }
}
项目:GitHub    文件:MainActivity.java   
@Override public void onRequestPermissionsResult(int requestCode,
                                                 @NonNull String[] permissions,
                                                 @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == STORAGE_PERMISSION_RC) {
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            handler.postDelayed(() -> findViewById(chooserDialog).performClick(), 1000);
        } else {
            Toast.makeText(this, "The folder or file chooser will not work without " +
                    "permission to read external storage.", Toast.LENGTH_LONG).show();
        }
    }
}
项目:CodeWatch    文件:DashboardFragment.java   
@OnClick({R.id.share_activity_chart, R.id.share_editors_chart, R.id.share_language_chart, R.id.share_os_chart})
public void onShareClick(View view) {
    Bitmap bitmap = null;
    switch (view.getId()) {
        case R.id.share_activity_chart:
            bitmap = lineChart.getChartBitmap();
            break;
        case R.id.share_editors_chart:
            bitmap = pieChartEditors.getChartBitmap();
            break;
        case R.id.share_language_chart:
            bitmap = pieChartLanguages.getChartBitmap();
            break;
        case R.id.share_os_chart:
            bitmap = pieChartOs.getChartBitmap();
            break;
        default:
            break;
    }
    if (bitmap != null) {
        //add watermark
        bitmap = UiUtils.addWaterMark(bitmap, context);

        try {
            FileProviderUtils.shareBitmap(context, bitmap);
        } catch (IOException e) {
            Timber.d(e, "IO Error while saving image");
            Toast.makeText(context, R.string.share_error, Toast.LENGTH_SHORT).show();
        }
        bitmap.recycle();
    }
}