Skip to content

Commit

Permalink
Code revert as will be handled in theming and localization cluster.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Jun 27, 2023
1 parent a080e66 commit 7743c4e
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,7 @@ open class FolderPickerActivity :
}

private fun toggleChooseEnabled() {
val isFolderSelectable = checkFolderSelectable()
mChooseBtn?.isEnabled = isFolderSelectable
mChooseBtn?.alpha = if (isFolderSelectable) 1f else 0.5f
mChooseBtn?.isEnabled = checkFolderSelectable()
}

// for copy and move, disable selecting parent folder of target files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.AbsListView;
import android.widget.Toast;

Expand Down Expand Up @@ -225,11 +224,6 @@ public class OCFileListFragment extends ExtendedListFragment implements

@Inject DeviceInfo deviceInfo;

//this variable will help us to provide number of span count for grid view
//the width for single item is approx to 360
private static final int GRID_ITEM_DEFAULT_WIDTH = 360;
private static final int DEFAULT_FALLBACK_SPAN_COUNT = 1;

protected enum MenuItemAddRemove {
DO_NOTHING,
REMOVE_SORT,
Expand Down Expand Up @@ -1320,22 +1314,6 @@ public void listDirectory(OCFile directory, OCFile file, boolean onlyOnDevice, b
}
}

if (searchView != null && !searchView.isIconified() && !fromSearch) {
searchView.post(() -> {
searchView.setQuery("", false);
searchView.onActionViewCollapsed();
Activity activity;
if ((activity = getActivity()) != null && activity instanceof FileDisplayActivity) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) activity;
fileDisplayActivity.hideSearchView(fileDisplayActivity.getCurrentDir());
if (getCurrentFile() != null) {
fileDisplayActivity
.setDrawerIndicatorEnabled(fileDisplayActivity.isRoot(getCurrentFile()));
}
}
});
}

mAdapter.swapDirectory(
accountManager.getUser(),
directory,
Expand Down Expand Up @@ -1472,40 +1450,12 @@ public int getSpanSize(int position) {
}

getRecyclerView().setLayoutManager(layoutManager);
calculateAndUpdateSpanCount(grid);
getRecyclerView().scrollToPosition(position);
getAdapter().setGridView(grid);
getRecyclerView().setAdapter(getAdapter());
getAdapter().notifyDataSetChanged();
}

/**
* method will calculate the number of spans required for grid item and will update the span accordingly
*
* @param isGrid
*/
private void calculateAndUpdateSpanCount(boolean isGrid) {
getRecyclerView().getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
getRecyclerView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
if (isGrid) {
int viewWidth = getRecyclerView().getMeasuredWidth();
int newSpanCount = viewWidth / GRID_ITEM_DEFAULT_WIDTH;
RecyclerView.LayoutManager layoutManager = getRecyclerView().getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
if (newSpanCount < 1) {
newSpanCount = DEFAULT_FALLBACK_SPAN_COUNT;
}
((GridLayoutManager) layoutManager).setSpanCount(newSpanCount);
layoutManager.requestLayout();
}
}
}
});
}

public CommonOCFileListAdapterInterface getCommonAdapter() {
return mAdapter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import com.nextcloud.client.account.CurrentAccountProvider
import com.nextcloud.client.core.AsyncRunner
import com.nextcloud.client.di.Injectable
import com.nextcloud.client.di.ViewModelFactory
import com.nextcloud.client.network.ClientFactory
import com.nmc.android.utils.KeyboardUtils
import com.nextcloud.client.network.ClientFactory
import com.owncloud.android.R
import com.owncloud.android.databinding.ListFragmentBinding
import com.owncloud.android.datamodel.FileDataStorageManager
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/menu/partial_drawer_entries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
android:icon="@drawable/nav_recently"
android:orderInCategory="0"
android:title="@string/drawer_item_recently_modified"
android:visible="false"/>
android:visible="true"/>
<item
android:orderInCategory="0"
android:id="@+id/nav_notifications"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -977,5 +977,4 @@
<item quantity="one">%d ausgewählt</item>
<item quantity="other">%d ausgewählt</item>
</plurals>
<string name="camera_permission_rationale">Bitte geben Sie unter Apps &amp; Benachrichtigungen in den Einstellungen manuell die Erlaubnis.</string>
</resources>
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1077,5 +1077,4 @@
<string name="document_scan_export_dialog_images">Multiple images</string>
<string name="download_cannot_create_file">Cannot create local file</string>
<string name="download_download_invalid_local_file_name">Invalid filename for local file</string>
<string name="camera_permission_rationale">Please navigate to App info in settings and give permission manually.</string>
</resources>

0 comments on commit 7743c4e

Please sign in to comment.