Skip to content

Commit

Permalink
Upload file button text size configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Aug 5, 2024
1 parent cf222d4 commit 8f292a5
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/src/main/java/com/nmc/android/utils/DisplayUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.nmc.android.utils

import android.content.res.Configuration
import com.owncloud.android.MainApp
import com.owncloud.android.R

object DisplayUtils {

@JvmStatic
fun isShowDividerForList(): Boolean = isTablet() || isLandscapeOrientation()

@JvmStatic
fun isTablet(): Boolean = MainApp.getAppContext().resources.getBoolean(R.bool.isTablet)

@JvmStatic
fun isLandscapeOrientation(): Boolean =
MainApp.getAppContext().resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -54,6 +55,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import javax.inject.Inject;

Expand Down Expand Up @@ -193,6 +195,19 @@ public void onCreate(Bundle savedInstanceState) {
binding.uploadFilesBtnUpload.setOnClickListener(this);
binding.uploadFilesBtnUpload.setEnabled(mLocalFolderPickerMode);

//reduce the button text size so that the text doesn't go to next line
//this should only happen for GERMAN language
//and device should not be tablet and should be in portrait mode
if (!com.nmc.android.utils.DisplayUtils.isTablet() && !com.nmc.android.utils.DisplayUtils.isLandscapeOrientation()) {
if (Locale.getDefault().getLanguage().equals(Locale.GERMAN.getLanguage())
|| Locale.getDefault().getLanguage().equals(Locale.GERMANY.getLanguage())) {
binding.uploadFilesBtnUpload.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(R.dimen.txt_size_13sp));
binding.uploadFilesBtnCancel.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(R.dimen.txt_size_13sp));
}
}

int localBehaviour = preferences.getUploaderBehaviour();

// file upload spinner
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-sw480dp/bool.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">true</bool>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values/bool.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">false</bool>
</resources>
31 changes: 31 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="grid_recyclerview_padding">4dp</dimen>
<dimen name="list_item_icons_size">16dp</dimen>
<dimen name="grid_item_icons_size">24dp</dimen>
<dimen name="media_grid_item_rv_spacing">6dp</dimen>
<dimen name="txt_size_18sp">18sp</dimen>
<dimen name="txt_size_15sp">15sp</dimen>
<dimen name="crop_corner_size">15dp</dimen>
<dimen name="edit_scan_bottom_bar_height">56dp</dimen>
<dimen name="standard_folders_grid_item_size">86dp</dimen>
<dimen name="standard_files_grid_item_size">80dp</dimen>
<dimen name="txt_size_11sp">11sp</dimen>
<dimen name="share_row_icon_size">30dp</dimen>
<dimen name="create_link_button_height">55dp</dimen>
<dimen name="note_et_height">258dp</dimen>
<dimen name="txt_size_17sp">17sp</dimen>
<dimen name="share_exp_date_divider_margin">20dp</dimen>
<dimen name="privacy_btn_width">160dp</dimen>
<dimen name="privacy_icon_size">50dp</dimen>
<dimen name="login_btn_width">150dp</dimen>
<dimen name="login_btn_height">55dp</dimen>
<dimen name="login_btn_bottom_margin">48dp</dimen>
<dimen name="login_btn_bottom_margin_land">48dp</dimen>
<dimen name="login_btn_bottom_margin_small_screen">24dp</dimen>
<dimen name="shared_with_me_icon_size">26dp</dimen>
<dimen name="txt_size_20sp">20sp</dimen>
<dimen name="notification_row_item_height">145dp</dimen>
<dimen name="button_stroke_width">1dp</dimen>
<dimen name="txt_size_13sp">13sp</dimen>
</resources>

0 comments on commit 8f292a5

Please sign in to comment.