Search in sources :

Example 81 with Toast

use of android.widget.Toast in project AmazeFileManager by TeamAmaze.

the class MainActivityHelper method mkFile.

public void mkFile(final HybridFile path, final MainFragment ma) {
    final Toast toast = Toast.makeText(ma.getActivity(), ma.getString(R.string.creatingfile), Toast.LENGTH_SHORT);
    toast.show();
    Operations.mkfile(path, ma.getActivity(), mainActivity.isRootExplorer(), new Operations.ErrorCallBack() {

        @Override
        public void exists(final HybridFile file) {
            ma.getActivity().runOnUiThread(() -> {
                if (toast != null)
                    toast.cancel();
                Toast.makeText(mainActivity, mainActivity.getString(R.string.fileexist), Toast.LENGTH_SHORT).show();
                if (ma != null && ma.getActivity() != null) {
                    // retry with dialog prompted again
                    mkfile(file.getMode(), file.getParent(), ma);
                }
            });
        }

        @Override
        public void launchSAF(HybridFile file) {
            ma.getActivity().runOnUiThread(() -> {
                if (toast != null)
                    toast.cancel();
                mainActivity.oppathe = path.getPath();
                mainActivity.operation = DataUtils.NEW_FILE;
                guideDialogForLEXA(mainActivity.oppathe);
            });
        }

        @Override
        public void launchSAF(HybridFile file, HybridFile file1) {
        }

        @Override
        public void done(HybridFile hFile, final boolean b) {
            ma.getActivity().runOnUiThread(() -> {
                if (b) {
                    ma.updateList();
                } else {
                    Toast.makeText(ma.getActivity(), ma.getString(R.string.operationunsuccesful), Toast.LENGTH_SHORT).show();
                }
            });
        }

        @Override
        public void invalidName(final HybridFile file) {
            ma.getActivity().runOnUiThread(() -> {
                if (toast != null)
                    toast.cancel();
                Toast.makeText(ma.getActivity(), ma.getString(R.string.invalid_name) + ": " + file.getName(), Toast.LENGTH_LONG).show();
            });
        }
    });
}
Also used : HybridFile(com.amaze.filemanager.filesystem.HybridFile) Toast(android.widget.Toast) Operations(com.amaze.filemanager.filesystem.Operations)

Example 82 with Toast

use of android.widget.Toast in project android_packages_apps_Dialer by LineageOS.

the class CallComposerActivity method placeRCSCall.

private void placeRCSCall(MultimediaData.Builder builder) {
    MultimediaData data = builder.build();
    LogUtil.i("CallComposerActivity.placeRCSCall", "placing enriched call, data: " + data);
    Logger.get(this).logImpression(DialerImpression.Type.CALL_COMPOSER_ACTIVITY_PLACE_RCS_CALL);
    getEnrichedCallManager().sendCallComposerData(sessionId, data);
    TelecomUtil.placeCall(this, new CallIntentBuilder(contact.getNumber(), CallInitiationType.Type.CALL_COMPOSER).build());
    setResult(RESULT_OK);
    SharedPreferences preferences = DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(this);
    // Show a toast for privacy purposes if this is the first time a user uses call composer.
    if (preferences.getBoolean(KEY_IS_FIRST_CALL_COMPOSE, true)) {
        int privacyMessage = data.hasImageData() ? R.string.image_sent_messages : R.string.message_sent_messages;
        Toast toast = Toast.makeText(this, privacyMessage, Toast.LENGTH_LONG);
        int yOffset = getResources().getDimensionPixelOffset(R.dimen.privacy_toast_y_offset);
        toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, yOffset);
        toast.show();
        preferences.edit().putBoolean(KEY_IS_FIRST_CALL_COMPOSE, false).apply();
    }
    finish();
}
Also used : MultimediaData(com.android.dialer.multimedia.MultimediaData) CallIntentBuilder(com.android.dialer.callintent.CallIntentBuilder) Toast(android.widget.Toast) SharedPreferences(android.content.SharedPreferences)

Example 83 with Toast

use of android.widget.Toast in project mongol-library by suragch.

the class MongolToast method show.

public void show() {
    Toast mongolToast = new Toast(context);
    mongolToast.setDuration(duration);
    mongolToast.setView(getLayout());
    mongolToast.show();
}
Also used : Toast(android.widget.Toast)

Example 84 with Toast

use of android.widget.Toast in project mongol-library by suragch.

the class MongolButtonActivity method normalButtonClick.

public void normalButtonClick(View view) {
    Toast toast = Toast.makeText(getApplicationContext(), "system button", Toast.LENGTH_SHORT);
    toast.show();
}
Also used : MongolToast(net.studymongolian.mongollibrary.MongolToast) Toast(android.widget.Toast)

Example 85 with Toast

use of android.widget.Toast in project mongol-library by suragch.

the class MongolToastActivity method toastClick.

public void toastClick(View view) {
    Toast toast = Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_LONG);
    toast.show();
}
Also used : MongolToast(net.studymongolian.mongollibrary.MongolToast) Toast(android.widget.Toast)

Aggregations

Toast (android.widget.Toast)485 Context (android.content.Context)89 View (android.view.View)86 TextView (android.widget.TextView)74 Intent (android.content.Intent)55 Rect (android.graphics.Rect)34 LayoutInflater (android.view.LayoutInflater)31 SuppressLint (android.annotation.SuppressLint)30 JSONObject (org.json.JSONObject)23 ImageView (android.widget.ImageView)21 RequestQueue (com.android.volley.RequestQueue)20 Response (com.android.volley.Response)20 EditText (android.widget.EditText)19 JSONException (org.json.JSONException)18 VolleyError (com.android.volley.VolleyError)17 JsonObjectRequest (com.android.volley.toolbox.JsonObjectRequest)17 User (model.User)16 PendingIntent (android.app.PendingIntent)15 File (java.io.File)15 HashMap (java.util.HashMap)15