Search in sources :

Example 61 with Snackbar

use of android.support.design.widget.Snackbar in project android by owncloud.

the class PassCodeActivity method showErrorAndRestart.

private void showErrorAndRestart(int errorMessage, int headerMessage, int explanationVisibility) {
    Arrays.fill(mPassCodeDigits, null);
    CharSequence errorSeq = getString(errorMessage);
    Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), errorSeq, Snackbar.LENGTH_LONG);
    snackbar.show();
    // TODO check if really needed
    mPassCodeHdr.setText(headerMessage);
    // TODO check if really needed
    mPassCodeHdrExplanation.setVisibility(explanationVisibility);
    clearBoxes();
}
Also used : Snackbar(android.support.design.widget.Snackbar)

Example 62 with Snackbar

use of android.support.design.widget.Snackbar in project android by owncloud.

the class LogHistoryActivity method sendMail.

/**
     * Start activity for sending email with logs attached
     */
private void sendMail() {
    // For the moment we need to consider the possibility that setup.xml
    // does not include the "mail_logger" entry. This block prevents that
    // compilation fails in this case.
    String emailAddress;
    try {
        Class<?> stringClass = R.string.class;
        Field mailLoggerField = stringClass.getField("mail_logger");
        int emailAddressId = (Integer) mailLoggerField.get(null);
        emailAddress = getString(emailAddressId);
    } catch (Exception e) {
        emailAddress = "";
    }
    ArrayList<Uri> uris = new ArrayList<Uri>();
    // Convert from paths to Android friendly Parcelable Uri's
    for (String file : Log_OC.getLogFileNames()) {
        File logFile = new File(mLogPath, file);
        if (logFile.exists()) {
            uris.add(Uri.fromFile(logFile));
        }
    }
    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.putExtra(Intent.EXTRA_EMAIL, emailAddress);
    String subject = String.format(getString(R.string.log_send_mail_subject), getString(R.string.app_name));
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setType(MAIL_ATTACHMENT_TYPE);
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
    try {
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), R.string.log_send_no_mail_app, Snackbar.LENGTH_LONG);
        snackbar.show();
        Log_OC.i(TAG, "Could not find app for sending log history.");
    }
}
Also used : ArrayList(java.util.ArrayList) Intent(android.content.Intent) Uri(android.net.Uri) IOException(java.io.IOException) ActivityNotFoundException(android.content.ActivityNotFoundException) Field(java.lang.reflect.Field) ActivityNotFoundException(android.content.ActivityNotFoundException) File(java.io.File) Snackbar(android.support.design.widget.Snackbar)

Example 63 with Snackbar

use of android.support.design.widget.Snackbar in project android by owncloud.

the class PrivacyPolicyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_privacy_policy);
    setupToolbar();
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTitle(getText(R.string.actionbar_privacy_policy));
    // Display the progress in a progress bar, like the browser app does.
    final ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.syncProgressBar);
    DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar);
    WebView webview = (WebView) findViewById(R.id.privacyPolicyWebview);
    webview.getSettings().setJavaScriptEnabled(true);
    //Enable zoom but hide display zoom controls
    webview.getSettings().setBuiltInZoomControls(true);
    webview.getSettings().setDisplayZoomControls(false);
    webview.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView view, int progress) {
            //Set the web page loading progress
            mProgressBar.setProgress(progress);
            if (progress == 100) {
                mProgressBar.setVisibility(View.GONE);
            }
        }
    });
    webview.setWebViewClient(new WebViewClient() {

        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), getString(R.string.privacy_policy_error) + description, Snackbar.LENGTH_LONG);
            snackbar.show();
        }
    });
    String urlPrivacyPolicy = getResources().getString(R.string.url_privacy_policy);
    webview.loadUrl(urlPrivacyPolicy);
}
Also used : WebChromeClient(android.webkit.WebChromeClient) WebView(android.webkit.WebView) ProgressBar(android.widget.ProgressBar) WebViewClient(android.webkit.WebViewClient) Snackbar(android.support.design.widget.Snackbar)

Example 64 with Snackbar

use of android.support.design.widget.Snackbar in project android by owncloud.

the class SharePasswordDialogFragment method onClick.

@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        String password = ((TextView) (getDialog().findViewById(R.id.share_password))).getText().toString();
        try {
            String encodedPassword = URLEncoder.encode(password, "UTF-8");
            if (encodedPassword.length() <= 0) {
                Snackbar snackbar = Snackbar.make(getActivity().findViewById(android.R.id.content), R.string.share_link_empty_password, Snackbar.LENGTH_LONG);
                snackbar.show();
                return;
            }
            if (mCreateShare) {
                // Share the file
                ((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaLink(mFile, encodedPassword);
            } else {
                // updat existing link
                ((FileActivity) getActivity()).getFileOperationsHelper().setPasswordToShareViaLink(mFile, encodedPassword);
            }
        } catch (UnsupportedEncodingException e) {
            Log_OC.i(TAG, "Error encoding the password for sharing a file/folder. " + e);
        }
    }
}
Also used : UnsupportedEncodingException(java.io.UnsupportedEncodingException) Snackbar(android.support.design.widget.Snackbar)

Example 65 with Snackbar

use of android.support.design.widget.Snackbar in project android by owncloud.

the class ShareFileFragment method onCreateView.

/**
     * {@inheritDoc}
     */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log_OC.d(TAG, "onCreateView");
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.share_file_layout, container, false);
    // Setup layout
    // Image
    ImageView icon = (ImageView) view.findViewById(R.id.shareFileIcon);
    icon.setImageResource(MimetypeIconUtil.getFileTypeIconId(mFile.getMimetype(), mFile.getFileName()));
    if (mFile.isImage()) {
        String remoteId = String.valueOf(mFile.getRemoteId());
        Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
        if (thumbnail != null) {
            icon.setImageBitmap(thumbnail);
        }
    }
    // Name
    TextView fileNameHeader = (TextView) view.findViewById(R.id.shareFileName);
    fileNameHeader.setText(getResources().getString(R.string.share_file, mFile.getFileName()));
    // Size
    TextView size = (TextView) view.findViewById(R.id.shareFileSize);
    if (mFile.isFolder()) {
        size.setVisibility(View.GONE);
    } else {
        size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength(), getActivity()));
    }
    final boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
    TextView shareNoUsers = (TextView) view.findViewById(R.id.shareNoUsers);
    //  Add User Button
    Button addUserGroupButton = (Button) view.findViewById(R.id.addUserButton);
    // for sharing with other users)
    if (!shareWithUsersEnable) {
        shareNoUsers.setText(R.string.share_incompatible_version);
        shareNoUsers.setGravity(View.TEXT_ALIGNMENT_CENTER);
        addUserGroupButton.setVisibility(View.GONE);
    }
    addUserGroupButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (shareWithUsersEnable) {
                // Show Search Fragment
                mListener.showSearchUsersAndGroups();
            } else {
                String message = getString(R.string.share_sharee_unavailable);
                Snackbar snackbar = Snackbar.make(getActivity().findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG);
                snackbar.show();
            }
        }
    });
    // Set listener for user actions on switch for sharing/unsharing via link
    initShareViaLinkListener(view);
    // Set listener for user actions on expiration date
    initExpirationListener(view);
    // Set listener for user actions on password
    initPasswordListener(view);
    // Set listener for user actions on edit permission
    initEditPermissionListener(view);
    // Hide share features sections that are not enabled
    hideNotEnabledShareSections(view);
    return view;
}
Also used : Bitmap(android.graphics.Bitmap) AppCompatButton(android.support.v7.widget.AppCompatButton) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView) Snackbar(android.support.design.widget.Snackbar)

Aggregations

Snackbar (android.support.design.widget.Snackbar)102 View (android.view.View)56 TextView (android.widget.TextView)25 Intent (android.content.Intent)13 RecyclerView (android.support.v7.widget.RecyclerView)13 BaseTransientBottomBar (android.support.design.widget.BaseTransientBottomBar)10 ImageView (android.widget.ImageView)10 ViewGroup (android.view.ViewGroup)8 DialogInterface (android.content.DialogInterface)7 LayoutInflater (android.view.LayoutInflater)6 AdapterView (android.widget.AdapterView)6 LinearLayout (android.widget.LinearLayout)6 ListView (android.widget.ListView)6 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)5 AlertDialog (android.app.AlertDialog)4 Context (android.content.Context)4 Nullable (android.support.annotation.Nullable)4 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 File (java.io.File)4 RemindyDAO (ve.com.abicelis.remindy.database.RemindyDAO)4