Commit 852aaf66 by Kunj Gupta

UOFLMA-80: Fix - UI issue in variable screen.

parent ab9f31e7
...@@ -143,12 +143,12 @@ public class CatalogueItemScreen extends AppCompatActivity { ...@@ -143,12 +143,12 @@ public class CatalogueItemScreen extends AppCompatActivity {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, public void onItemClick(AdapterView<?> parent, View view,
int position, long id) { int position, long id) {
CatalogueLog.e("OnItemClickListener: position: " + position + ", Catalogue: " + catalogueItemList.get(position)); CatalogueItem catalogueItem = catalogueItemList.get(position);
Intent intent = new Intent(CatalogueItemScreen.this, CatalogueVariableScreen.class); Intent intent = new Intent(CatalogueItemScreen.this, CatalogueVariableScreen.class);
intent.putExtra(Constants.DATA_KEY_SYS_ID, catalogueItemList.get(position).getSysId()); intent.putExtra(Constants.DATA_KEY_SYS_ID, catalogueItem.getSysId());
intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_DESCRIPTION, catalogueItemList.get(position).getDescription()); intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_DESCRIPTION, catalogueItem.getDescription());
intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION, catalogueItemList.get(position).getShortDescription()); intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION, catalogueItem.getShortDescription());
intent.putExtra(Constants.DATA_KEY_CATALOGUE_TITLE, catalogueItemList.get(position).getName()); intent.putExtra(Constants.DATA_KEY_CATALOGUE_TITLE, catalogueItem.getName());
startActivity(intent); startActivity(intent);
} }
}); });
......
...@@ -52,8 +52,6 @@ import com.vsoft.uoflservicenow.api.listeners.get.GetVariableChoiceApiListener; ...@@ -52,8 +52,6 @@ import com.vsoft.uoflservicenow.api.listeners.get.GetVariableChoiceApiListener;
import com.vsoft.uoflservicenow.api.listeners.post.PostVariableFormApiListener; import com.vsoft.uoflservicenow.api.listeners.post.PostVariableFormApiListener;
import com.vsoft.uoflservicenow.api.managers.CatalogueVariableApiManager; import com.vsoft.uoflservicenow.api.managers.CatalogueVariableApiManager;
import com.vsoft.uoflservicenow.api.managers.VariableChoiceApiManager; import com.vsoft.uoflservicenow.api.managers.VariableChoiceApiManager;
import com.vsoft.uoflservicenow.db.models.Catalogue;
import com.vsoft.uoflservicenow.db.models.CatalogueOrder;
import com.vsoft.uoflservicenow.db.models.CatalogueVariable; import com.vsoft.uoflservicenow.db.models.CatalogueVariable;
import com.vsoft.uoflservicenow.db.models.CatalogueVariableSet; import com.vsoft.uoflservicenow.db.models.CatalogueVariableSet;
import com.vsoft.uoflservicenow.db.models.Reference; import com.vsoft.uoflservicenow.db.models.Reference;
...@@ -78,7 +76,6 @@ import java.io.FileInputStream; ...@@ -78,7 +76,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -252,6 +249,7 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -252,6 +249,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
TextView shortDescriptionView = new TextView(CatalogueVariableScreen.this); TextView shortDescriptionView = new TextView(CatalogueVariableScreen.this);
shortDescriptionView.setPadding(0, 0, 0, (int)getResources().getDimension(R.dimen.normal_margin)); shortDescriptionView.setPadding(0, 0, 0, (int)getResources().getDimension(R.dimen.normal_margin));
shortDescriptionView.setTypeface(null, Typeface.BOLD); shortDescriptionView.setTypeface(null, Typeface.BOLD);
shortDescriptionView.setTextColor(ContextCompat.getColor(CatalogueVariableScreen.this, android.R.color.black));
shortDescriptionView.setMovementMethod(LinkMovementMethod.getInstance()); shortDescriptionView.setMovementMethod(LinkMovementMethod.getInstance());
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
shortDescriptionView.setText(Html.fromHtml(mCatalogueItemShortDescription, Html.FROM_HTML_MODE_LEGACY)); shortDescriptionView.setText(Html.fromHtml(mCatalogueItemShortDescription, Html.FROM_HTML_MODE_LEGACY));
...@@ -263,8 +261,13 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -263,8 +261,13 @@ public class CatalogueVariableScreen extends AppCompatActivity {
} }
if(mCatalogueItemDescription != null && !mCatalogueItemDescription.isEmpty()) { if(mCatalogueItemDescription != null && !mCatalogueItemDescription.isEmpty()) {
/*Replace /r/n with blank string*/
StringBuilder builder = new StringBuilder();
builder.append(mCatalogueItemDescription.replaceAll("\r\n", "<br />"));
builder.append("\n");
builder.append(getString(R.string.Variable_form_short_description_anchor_line_break_css));
WebView descriptionView = new WebView(CatalogueVariableScreen.this); WebView descriptionView = new WebView(CatalogueVariableScreen.this);
descriptionView.loadData(mCatalogueItemDescription, "text/html; charset=utf-8", "utf-8"); descriptionView.loadData(builder.toString(), "text/html; charset=UTF-8", "UTF-8");
mContainerLayout.addView(descriptionView, childControlViewLayoutParams); mContainerLayout.addView(descriptionView, childControlViewLayoutParams);
} }
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/white" android:background="@android:color/white"
android:requiresFadingEdge="vertical"> android:requiresFadingEdge="vertical"
android:scrollbars="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -57,6 +57,13 @@ ...@@ -57,6 +57,13 @@
<string name="variable_form_ui_page_no_selected_attachment_string">Not Selected</string> <string name="variable_form_ui_page_no_selected_attachment_string">Not Selected</string>
<string name="custom_setting_storage_permission_dialog_msg_string">To use this feature, please go to Settings -> Apps -> %s -> Permissions and enable \'Storage\' permission</string> <string name="custom_setting_storage_permission_dialog_msg_string">To use this feature, please go to Settings -> Apps -> %s -> Permissions and enable \'Storage\' permission</string>
<string name="variable_form_back_navigation_string">Are you sure you want to navigate away?</string> <string name="variable_form_back_navigation_string">Are you sure you want to navigate away?</string>
<string name="Variable_form_short_description_anchor_line_break_css"><![CDATA[
<style>
a {
word-break: break-all;
}
</style>
]]></string>
<!--Catalogue Item Screen--> <!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string> <string name="no_catalogue_item_string">No Catalogue Items&#8230;</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment