Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ buildscript {

// Android jetpack
archLifecycleVersion = "2.1.0"
roomVersion = "2.2.2"
roomVersion = "2.2.5"
appCompat = "1.1.0"
sqliteVersion = "2.0.1"
lifecycleLiveData = "2.0.0"
sqliteVersion = "2.1.0"
lifecycleLiveData = "2.2.0"
biometricVersion="1.0.1"

// Kotlin
Expand All @@ -35,9 +35,9 @@ buildscript {
ktxVersion = "1.1.0"

// KTX extensions
ktxCoreVersion = "1.1.0"
ktxViewModelVersion = "2.2.0-alpha01"
ktxFragmentVersion = "1.0.0"
ktxCoreVersion = "1.3.0"
ktxViewModelVersion = "2.2.0"
ktxFragmentVersion = "1.2.4"
ktxLiveData = "2.1.0"
}

Expand Down
2 changes: 1 addition & 1 deletion owncloud-android-library
6 changes: 3 additions & 3 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
exclude module: 'objenesis'
}
androidTestImplementation 'com.github.tmurakami:dexopener:2.0.4'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:runner:1.2.0'

// Image loading
implementation('com.github.bumptech.glide:glide:4.6.1') {
Expand All @@ -66,11 +66,11 @@ dependencies {
implementation "androidx.multidex:multidex:2.0.1"

// Convert Java Objects into JSON and back
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.code.gson:gson:2.8.6'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"

implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-common-java8:$archLifecycleVersion"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class EditPrivateShareFragment : DialogFragment() {
try {
listener = activity as ShareFragmentListener?
} catch (e: IllegalStateException) {
throw IllegalStateException(activity!!.toString() + " must implement OnShareFragmentInteractionListener")
throw IllegalStateException(requireActivity().toString() + " must implement OnShareFragmentInteractionListener")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class PublicShareDialogFragment : DialogFragment() {
val publicLinkExpirationDateInMillis = expirationDateValueInMillis

val publicLinkPermissions: Int
var publicUploadPermission: Boolean
val publicUploadPermission: Boolean

when (shareViaLinkEditPermissionGroup?.checkedRadioButtonId) {
R.id.shareViaLinkEditPermissionUploadFiles -> {
Expand Down Expand Up @@ -569,7 +569,7 @@ class PublicShareDialogFragment : DialogFragment() {
)
dialog.setDatePickerListener(this)
dialog.show(
activity!!.supportFragmentManager,
requireActivity().supportFragmentManager,
ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
)
} else {
Expand All @@ -593,7 +593,7 @@ class PublicShareDialogFragment : DialogFragment() {
)
dialog.setDatePickerListener(this)
dialog.show(
activity!!.supportFragmentManager,
requireActivity().supportFragmentManager,
ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class SearchShareesFragment : Fragment(),

private fun observePrivateShares() {
ocShareViewModel.shares.observe(
this,
viewLifecycleOwner,
Event.EventObserver { uiResult ->
val privateShares = uiResult.getStoredData()?.filter { share ->
share.shareType == ShareType.USER ||
Expand All @@ -172,7 +172,7 @@ class SearchShareesFragment : Fragment(),
)

// Show data
val usersList = view!!.findViewById<ListView>(R.id.searchUsersListView)
val usersList = requireView().findViewById<ListView>(R.id.searchUsersListView)

if (privateShares.isNotEmpty()) {
usersList.visibility = View.VISIBLE
Expand All @@ -194,7 +194,7 @@ class SearchShareesFragment : Fragment(),
override fun onStart() {
super.onStart()
// focus the search view and request the software keyboard be shown
val searchView = view!!.findViewById<View>(R.id.searchView)
val searchView = requireView().findViewById<View>(R.id.searchView)
if (searchView.requestFocus()) {
val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(searchView.findFocus(), InputMethodManager.SHOW_IMPLICIT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Timber.d("onCreate")
if (arguments != null) {
file = arguments!!.getParcelable(ARG_FILE)
account = arguments!!.getParcelable(ARG_ACCOUNT)
arguments?.let {
file = it.getParcelable(ARG_FILE)
account = it.getParcelable(ARG_ACCOUNT)
}
}

Expand Down Expand Up @@ -276,7 +276,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
super.onActivityCreated(savedInstanceState)
Timber.d("onActivityCreated")

activity!!.setTitle(R.string.share_dialog_title)
activity?.setTitle(R.string.share_dialog_title)

observeCapabilities() // Get capabilities to update some UI elements depending on them
observeShares()
Expand All @@ -287,7 +287,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
try {
listener = context as ShareFragmentListener?
} catch (e: ClassCastException) {
throw ClassCastException(activity!!.toString() + " must implement OnShareFragmentInteractionListener")
throw ClassCastException(activity.toString() + " must implement OnShareFragmentInteractionListener")
}
}

Expand All @@ -298,7 +298,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe

private fun observeCapabilities() {
ocCapabilityViewModel.capabilities.observe(
this,
viewLifecycleOwner,
Observer { event ->
val uiResult = event.peekContent()
val capabilities = uiResult.getStoredData()
Expand Down Expand Up @@ -331,7 +331,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe

private fun observeShares() {
ocShareViewModel.shares.observe(
this,
viewLifecycleOwner,
Observer { event ->
val uiResult = event.peekContent()
val shares = uiResult.getStoredData()
Expand Down Expand Up @@ -413,7 +413,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
// Update list of users/groups
// TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
userGroupsAdapter = ShareUserListAdapter(
context!!,
requireContext(),
R.layout.share_user_item,
privateShares,
this
Expand Down Expand Up @@ -480,7 +480,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
*/
private fun updateListOfPublicLinks() {
publicLinksAdapter = SharePublicLinkListAdapter(
context!!,
requireContext(),
R.layout.share_public_link_item,
publicLinks,
this
Expand Down Expand Up @@ -530,9 +530,9 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
*
*/
private fun hideSectionsDisabledInBuildTime(view: View) {
val shareViaLinkAllowed = activity!!.resources.getBoolean(R.bool.share_via_link_feature)
val shareWithUsersAllowed = activity!!.resources.getBoolean(R.bool.share_with_users_feature)
val shareWarningAllowed = activity!!.resources.getBoolean(R.bool.warning_sharing_public_link)
val shareViaLinkAllowed = requireActivity().resources.getBoolean(R.bool.share_via_link_feature)
val shareWithUsersAllowed = requireActivity().resources.getBoolean(R.bool.share_with_users_feature)
val shareWarningAllowed = requireActivity().resources.getBoolean(R.bool.warning_sharing_public_link)

// Hide share via link section if it is not enabled
if (!shareViaLinkAllowed) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
Expand All @@ -9,18 +9,19 @@
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.owncloud.android.ui.dialog;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
Expand All @@ -30,6 +31,7 @@
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.DialogFragment;
Expand All @@ -41,12 +43,11 @@
import com.owncloud.android.utils.PreferenceUtils;

/**
* Dialog to input the name for a new folder to create.
*
* Triggers the folder creation when name is confirmed.
* Dialog to input the name for a new folder to create.
* <p>
* Triggers the folder creation when name is confirmed.
*/
public class CreateFolderDialogFragment
extends DialogFragment implements DialogInterface.OnClickListener {
public class CreateFolderDialogFragment extends DialogFragment implements DialogInterface.OnClickListener {

private static final String ARG_PARENT_FOLDER = "PARENT_FOLDER";

Expand All @@ -55,7 +56,7 @@ public class CreateFolderDialogFragment
/**
* Public factory method to create new CreateFolderDialogFragment instances.
*
* @param parentFolder Folder to create
* @param parentFolder Folder to create
* @return Dialog ready to show.
*/
public static CreateFolderDialogFragment newInstance(OCFile parentFolder) {
Expand All @@ -68,20 +69,22 @@ public static CreateFolderDialogFragment newInstance(OCFile parentFolder) {

private OCFile mParentFolder;

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER);
mParentFolder = requireArguments().getParcelable(ARG_PARENT_FOLDER);

// Inflate the layout for the dialog
LayoutInflater inflater = getActivity().getLayoutInflater();
LayoutInflater inflater = requireActivity().getLayoutInflater();
@SuppressLint("InflateParams")
View v = inflater.inflate(R.layout.edit_box_dialog, null);

// Allow or disallow touches with other visible windows
v.setFilterTouchesWhenObscured(
PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext())
);

CoordinatorLayout coordinatorLayout = getActivity().findViewById(R.id.coordinator_layout);
CoordinatorLayout coordinatorLayout = requireActivity().findViewById(R.id.coordinator_layout);

coordinatorLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext())
Expand All @@ -93,7 +96,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
inputText.requestFocus();

// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
builder.setView(v)
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, this)
Expand All @@ -107,8 +110,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
public void onClick(DialogInterface dialog, int which) {
if (which == AlertDialog.BUTTON_POSITIVE) {
String newFolderName =
((TextView) (getDialog().findViewById(R.id.user_input)))
.getText().toString().trim();
((TextView) (requireDialog().findViewById(R.id.user_input))).getText().toString().trim();

if (newFolderName.length() <= 0) {
showSnackMessage(R.string.filename_empty);
Expand All @@ -122,19 +124,18 @@ public void onClick(DialogInterface dialog, int which) {

String path = mParentFolder.getRemotePath();
path += newFolderName + OCFile.PATH_SEPARATOR;
((ComponentsGetter) getActivity()).
getFileOperationsHelper().createFolder(path, false);
((ComponentsGetter) requireActivity()).getFileOperationsHelper().createFolder(path, false);
}
}

/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar snackbar = Snackbar.make(
getActivity().findViewById(R.id.coordinator_layout),
requireActivity().findViewById(R.id.coordinator_layout),
messageResource,
Snackbar.LENGTH_LONG
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ class RemoveShareDialogFragment : ConfirmationDialogFragment(), ConfirmationDial

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState)
targetShare = arguments!!.getParcelable(ARG_TARGET_SHARE)
account = arguments!!.getParcelable(ARG_ACCOUNT)
arguments?.let {
targetShare = it.getParcelable(ARG_TARGET_SHARE)
account = it.getParcelable(ARG_ACCOUNT)
}

setOnConfirmationListener(this)

Expand All @@ -63,7 +65,7 @@ class RemoveShareDialogFragment : ConfirmationDialogFragment(), ConfirmationDial
try {
listener = activity as ShareFragmentListener?
} catch (e: IllegalStateException) {
throw IllegalStateException(activity!!.toString() + " must implement OnShareFragmentInteractionListener")
throw IllegalStateException(requireActivity().toString() + " must implement OnShareFragmentInteractionListener")
}
}

Expand Down
1 change: 0 additions & 1 deletion owncloudTestUtil/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':owncloudDomain')
implementation project(':owncloud-android-library:owncloudComLibrary')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
Expand Down