Pārlūkot izejas kodu

move further Snackbar calls to Utils implementation

AndyScherzinger 6 gadi atpakaļ
vecāks
revīzija
5c6dd299a1

+ 4 - 4
src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java

@@ -26,7 +26,6 @@ import android.content.ActivityNotFoundException;
 import android.content.Intent;
 import android.graphics.Bitmap;
 import android.net.Uri;
-import android.support.design.widget.Snackbar;
 import android.text.format.DateUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -280,9 +279,10 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
                         requester.retry(mParentActivity, item);
                         loadUploadItemsFromDb();
                     } else {
-                        Snackbar.make(v.getRootView().findViewById(android.R.id.content),
-                                mParentActivity.getString(R.string.local_file_not_found_message), Snackbar.LENGTH_LONG)
-                                .show();
+                        DisplayUtils.showSnackMessage(
+                                v.getRootView().findViewById(android.R.id.content),
+                                R.string.local_file_not_found_message
+                        );
                     }
                 });
             }

+ 4 - 5
src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java

@@ -26,7 +26,6 @@ import android.graphics.PorterDuff;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
-import android.support.design.widget.Snackbar;
 import android.support.v4.app.DialogFragment;
 import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
@@ -40,6 +39,7 @@ import android.widget.TextView;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.activity.FileActivity;
+import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ThemeUtils;
 
 /**
@@ -134,11 +134,10 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
             String password = ((TextView) (getDialog().findViewById(R.id.share_password))).getText().toString();
 
             if (password.length() <= 0) {
-                Snackbar.make(
+                DisplayUtils.showSnackMessage(
                         getActivity().findViewById(android.R.id.content),
-                        R.string.share_link_empty_password,
-                        Snackbar.LENGTH_LONG
-                ).show();
+                        R.string.share_link_empty_password
+                );
                 return;
             }
 

+ 1 - 1
src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -713,7 +713,7 @@ public class FileOperationsHelper {
 
                 intent.setDataAndType(uri, file.getMimetype());
             } catch (ActivityNotFoundException exception) {
-                Snackbar.make(view, R.string.picture_set_as_no_app, Snackbar.LENGTH_LONG).show();
+                DisplayUtils.showSnackMessage(view, R.string.picture_set_as_no_app);
             }
         } else {
             Log_OC.wtf(TAG, "Trying to send a NULL OCFile");

+ 2 - 6
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -23,7 +23,6 @@ import android.accounts.Account;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
-import android.support.design.widget.Snackbar;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -44,6 +43,7 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
 import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
 import org.mozilla.universalchardet.ReaderFactory;
@@ -328,11 +328,7 @@ public class PreviewTextFragment extends FileFragment {
         switch (item.getItemId()) {
             case R.id.action_send_share_file: {
                 if(getFile().isSharedWithMe() && !getFile().canReshare()){
-                    Snackbar.make(getView(),
-                            R.string.resharing_is_not_allowed,
-                            Snackbar.LENGTH_LONG
-                    )
-                            .show();
+                    DisplayUtils.showSnackMessage(getView(), R.string.resharing_is_not_allowed);
                 } else {
                     mContainerActivity.getFileOperationsHelper().sendShareFile(getFile());
                 }