Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 2fa741d9 authored by alperozturk's avatar alperozturk
Browse files

cleanup translations

parent 1c83a3d9
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap
        binding.searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);

        ShareRepository repository = ShareRepository.getInstance(getApplicationContext());
        UsersAndGroupsSearchProvider provider = new UsersAndGroupsSearchProvider(this, account, repository);
        UsersAndGroupsSearchProvider provider = new UsersAndGroupsSearchProvider(this, repository);
        binding.searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
@@ -209,7 +209,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap
            }
        });

        binding.searchView.setQueryHint(getResources().getString(R.string.note_share_fragment_search_text));
        binding.searchView.setQueryHint(getResources().getString(R.string.note_share_activity_search_text));
        binding.searchView.setInputType(InputType.TYPE_NULL);
    }

@@ -283,7 +283,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap

    public void copyInternalLink() {
        if (account == null) {
            DisplayUtils.showSnackMessage(this, getString(R.string.note_share_fragment_could_not_retrieve_url));
            DisplayUtils.showSnackMessage(this, getString(R.string.note_share_activity_could_not_retrieve_url));
            return;
        }

@@ -297,7 +297,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap

        intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
        intentToShareLink.setType("text/plain");
        intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.note_share_fragment_subject_shared_with_you, note.getTitle()));
        intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.note_share_activity_subject_shared_with_you, note.getTitle()));

        String[] packagesToExclude = new String[] { this.getPackageName() };
        DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
@@ -644,7 +644,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap
                if (isGranted) {
                    pickContactEmail();
                } else {
                    BrandedSnackbar.make(binding.getRoot(), getString(R.string.contact_no_permission), Snackbar.LENGTH_LONG)
                    BrandedSnackbar.make(binding.getRoot(), getString(R.string.note_share_activity_contact_no_permission), Snackbar.LENGTH_LONG)
                            .show();
                }
            });
+8 −8
Original line number Diff line number Diff line
@@ -222,9 +222,9 @@ class NoteShareDetailActivity : BrandedActivity(), ExpirationDatePickerDialogFra
        // because we have link to share in Public Link
        binding.shareProcessBtnNext.text = getString(
            if (shareType == ShareType.PUBLIC_LINK) {
                R.string.share_copy_link
                R.string.note_share_detail_activity_share_copy_link
            } else {
                R.string.common_confirm
                R.string.note_share_detail_activity_common_confirm
            }
        )

@@ -236,7 +236,7 @@ class NoteShareDetailActivity : BrandedActivity(), ExpirationDatePickerDialogFra
    }

    private fun setupUpdateUI() {
        binding.shareProcessBtnNext.text = getString(R.string.common_next)
        binding.shareProcessBtnNext.text = getString(R.string.note_share_detail_activity_common_next)
        file.let {
            updateViewForFile()
            updateViewForShareType()
@@ -353,10 +353,10 @@ class NoteShareDetailActivity : BrandedActivity(), ExpirationDatePickerDialogFra
        binding.shareProcessEditShareLink.visibility = View.GONE
        binding.shareProcessGroupTwo.visibility = View.VISIBLE
        if (share != null) {
            binding.shareProcessBtnNext.text = getString(R.string.set_note)
            binding.shareProcessBtnNext.text = getString(R.string.note_share_detail_activity_set_note)
            binding.noteText.setText(share?.note)
        } else {
            binding.shareProcessBtnNext.text = getString(R.string.send_share)
            binding.shareProcessBtnNext.text = getString(R.string.note_share_detail_activity_send_share)
            binding.noteText.setText(R.string.empty)
        }
        shareProcessStep = SCREEN_TYPE_NOTE
@@ -452,14 +452,14 @@ class NoteShareDetailActivity : BrandedActivity(), ExpirationDatePickerDialogFra
    private fun validateShareProcessFirst() {
        permission = getSelectedPermission()
        if (permission == OCShare.NO_PERMISSION) {
            DisplayUtils.showSnackMessage(binding.root, R.string.no_share_permission_selected)
            DisplayUtils.showSnackMessage(binding.root, R.string.note_share_detail_activity_no_share_permission_selected)
            return
        }

        if (binding.shareProcessSetPasswordSwitch.isChecked &&
            binding.shareProcessEnterPassword.text?.trim().isNullOrEmpty()
        ) {
            DisplayUtils.showSnackMessage(binding.root, R.string.share_link_empty_password)
            DisplayUtils.showSnackMessage(binding.root, R.string.note_share_detail_activity_share_link_empty_password)
            return
        }

@@ -473,7 +473,7 @@ class NoteShareDetailActivity : BrandedActivity(), ExpirationDatePickerDialogFra
        if (binding.shareProcessChangeNameSwitch.isChecked &&
            binding.shareProcessChangeName.text?.trim().isNullOrEmpty()
        ) {
            DisplayUtils.showSnackMessage(binding.root, R.string.label_empty)
            DisplayUtils.showSnackMessage(binding.root, R.string.note_share_detail_activity_label_empty)
            return
        }

+2 −2
Original line number Diff line number Diff line
@@ -116,10 +116,10 @@ public class QuickSharingPermissionsBottomSheetDialog extends BottomSheetDialog
        String[] permissionArray;
        if (ocShare.isFolder()) {
            permissionArray =
                    activity.getResources().getStringArray(R.array.folder_share_permission_dialog_values);
                    activity.getResources().getStringArray(R.array.quick_sharing_permission_bottom_sheet_dialog_folder_share_values);
        } else {
            permissionArray =
                    activity.getResources().getStringArray(R.array.file_share_permission_dialog_values);
                    activity.getResources().getStringArray(R.array.quick_sharing_permission_bottom_sheet_dialog_note_share_values);
        }
        //get the checked item position
        int checkedItem = SharingMenuHelper.getPermissionCheckedItem(activity, ocShare, permissionArray);
+5 −5
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import it.niedermann.owncloud.notes.shared.util.extensions.getSerializableArgume
 */
class SharePasswordDialogFragment : DialogFragment() {

    var keyboardUtils: KeyboardUtils? = null
    private var keyboardUtils: KeyboardUtils? = null

    private var binding: PasswordDialogBinding? = null
    private var note: Note? = null
@@ -52,7 +52,7 @@ class SharePasswordDialogFragment : DialogFragment() {
                        if (!askForPassword && TextUtils.isEmpty(password)) {
                            BrandedSnackbar.make(
                                binding!!.root,
                                getString(R.string.share_link_empty_password),
                                getString(R.string.note_share_detail_activity_share_link_empty_password),
                                Snackbar.LENGTH_LONG
                            )
                                .show()
@@ -105,11 +105,11 @@ class SharePasswordDialogFragment : DialogFragment() {
        val neutralButtonTextId: Int
        val title: Int
        if (askForPassword) {
            title = R.string.share_link_optional_password_title
            neutralButtonTextId = R.string.common_skip
            title = R.string.share_password_dialog_fragment_share_link_optional_password_title
            neutralButtonTextId = R.string.share_password_dialog_fragment_skip
        } else {
            title = R.string.share_link_password_title
            neutralButtonTextId = R.string.common_cancel
            neutralButtonTextId = R.string.note_share_detail_activity_cancel
        }

        // Build the dialog
+8 −75
Original line number Diff line number Diff line
@@ -11,16 +11,12 @@ import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.BaseColumns;
import android.text.TextUtils;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.nextcloud.android.sso.helper.SingleAccountHelper;
import com.nextcloud.android.sso.model.SingleSignOnAccount;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -31,20 +27,13 @@ import com.owncloud.android.lib.resources.users.StatusType;

import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutionException;

import it.niedermann.nextcloud.sso.glide.SingleSignOnUrl;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.persistence.ShareRepository;
import it.niedermann.owncloud.notes.persistence.entity.Account;
import it.niedermann.owncloud.notes.share.model.UsersAndGroupsSearchConfig;

/**
@@ -84,18 +73,14 @@ public class UsersAndGroupsSearchProvider {
    private final String DATA_EMAIL;
    private final String DATA_CIRCLE;

    private final UriMatcher mUriMatcher;

    private final ShareRepository repository;
    private final Account account;
    private final Context context;

    public UsersAndGroupsSearchProvider(Context context, Account account, ShareRepository repository) {
    public UsersAndGroupsSearchProvider(Context context, ShareRepository repository) {
        this.context = context;
        this.account = account;
        this.repository = repository;

        AUTHORITY = context.getString(R.string.users_and_groups_search_authority);
        AUTHORITY = context.getString(R.string.users_and_groups_search_provider_authority);
        setActionShareWith(context);
        DATA_USER = AUTHORITY + ".data.user";
        DATA_GROUP = AUTHORITY + ".data.group";
@@ -111,18 +96,14 @@ public class UsersAndGroupsSearchProvider {
        sShareTypes.put(DATA_EMAIL, ShareType.EMAIL);
        sShareTypes.put(DATA_CIRCLE, ShareType.CIRCLE);

        mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        UriMatcher mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        mUriMatcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH);
    }

    private static final Map<String, ShareType> sShareTypes = new HashMap<>();

    public static ShareType getShareType(String authority) {
        return sShareTypes.get(authority);
    }

    private static void setActionShareWith(@NonNull Context context) {
        ACTION_SHARE_WITH = context.getString(R.string.users_and_groups_share_with);
        ACTION_SHARE_WITH = context.getString(R.string.users_and_groups_search_provider_share_with);
    }

    public Cursor searchForUsersOrGroups(String userQuery) {
@@ -246,10 +227,10 @@ public class UsersAndGroupsSearchProvider {

                    if (displayName != null && dataUri != null) {
                        response.newRow()
                                .add(count++)             // BaseColumns._ID
                                .add(displayName)         // SearchManager.SUGGEST_COLUMN_TEXT_1
                                .add(subline)             // SearchManager.SUGGEST_COLUMN_TEXT_2
                                .add(icon)                // SearchManager.SUGGEST_COLUMN_ICON_1
                                .add(count++)
                                .add(displayName)
                                .add(subline)
                                .add(icon)
                                .add(dataUri)
                                .add(SHARE_WITH, shareWith)
                                .add(SHARE_TYPE, type.getValue());
@@ -265,52 +246,4 @@ public class UsersAndGroupsSearchProvider {

        return null;
    }

    public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {
        try {
            Bitmap avatar = Glide.with(context)
                    .asBitmap()
                    .load(new SingleSignOnUrl(account.getAccountName(), account.getUrl() + "/index.php/avatar/" + Uri.encode(account.getUserName()) + "/64"))
                    .placeholder(R.drawable.ic_account_circle_grey_24dp)
                    .error(R.drawable.ic_account_circle_grey_24dp)
                    .apply(RequestOptions.circleCropTransform())
                    .submit()
                    .get();

            // create a file to write bitmap data
            File f = new File(context.getCacheDir(), "test");
            try {
                if (f.exists()) {
                    if (!f.delete()) {
                        throw new IllegalStateException("Existing file could not be deleted!");
                    }
                }
                if (!f.createNewFile()) {
                    throw new IllegalStateException("File could not be created!");
                }

                //Convert bitmap to byte array
                ByteArrayOutputStream bos = new ByteArrayOutputStream();

                avatar.compress(Bitmap.CompressFormat.PNG, 90, bos);
                byte[] bitmapData = bos.toByteArray();

                //write the bytes in file
                try (FileOutputStream fos = new FileOutputStream(f)) {
                    fos.write(bitmapData);
                } catch (FileNotFoundException e) {
                    Log_OC.e(TAG, "File not found: " + e.getMessage());
                }

            } catch (Exception e) {
                Log_OC.e(TAG, "Error opening file: " + e.getMessage());
            }

            return ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
Loading