Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

article title fit size on List and Detail pages

  • Loading branch information...
commit 527645c9c90d7757963d1f5311f639c3239c89cd 1 parent 958a46b
@glebpopoff authored
View
4 .gitignore
@@ -1,2 +1,6 @@
+*.zip
+*.keystore
+.DS_Store
+submission/
bin/
gen/
View
4 AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.glebpopov.hackernews"
- android:versionCode="17"
- android:versionName="2.3.4">
+ android:versionCode="18"
+ android:versionName="2.3.4b">
<uses-sdk android:minSdkVersion="7" />
<application
View
BIN  res/.DS_Store
Binary file not shown
View
1  res/layout/comments_header_view.xml
@@ -41,6 +41,7 @@
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:ellipsize="none"
style="@style/TextHeader" />
<TextView android:id="@+id/news_hour"
View
1  res/layout/fragment_comments.xml
@@ -34,6 +34,7 @@
android:layout_height="wrap_content"
style="@style/TextHeaderSub" />
+
<TextView android:id="@+id/comment_comment"
android:layout_alignParentLeft="true"
android:layout_below="@+id/comment_author"
View
1  res/layout/fragment_news.xml
@@ -28,6 +28,7 @@
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:ellipsize="none"
style="@style/TextHeader" />
<TextView android:id="@+id/news_hour"
View
2  res/layout/news_fragment_dialog_title.xml
@@ -2,7 +2,7 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/title"
android:textAppearance="?android:attr/textAppearanceInverse"
- android:layout_width="match_parent"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="9dip"
android:paddingBottom="9dip"
View
70 src/com/glebpopov/hackernews/fragments/CommentsFragment.java
@@ -20,6 +20,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
+import android.text.Html;
import android.text.util.Linkify;
import android.util.Log;
import android.view.ContextMenu;
@@ -65,59 +66,6 @@ public CommentsFragment(Activity m)
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- /*storyItem = (NewsItem) getActivity().getIntent().getSerializableExtra("story_item");
- if (storyItem != null && storyItem.getId() > 0 && storyItem.getTitle() != null)
- {
- if (mActivity == null)
- {
- mActivity = getActivity();
- }
-
- if (mActivity == null)
- {
- Toast.makeText(mActivity, "Something went wrong. Please restart the app.", 50000).show();
- return;
- }
-
- //add headerview
- LayoutInflater vi = (LayoutInflater)mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View v = vi.inflate(R.layout.comments_header_view, null);
- if (v != null)
- {
- TextView storyTitleView = (TextView) v.findViewById(R.id.story_title);
- TextView storyPostedWhenView = (TextView) v.findViewById(R.id.story_hour);
- TextView storyDomainView = (TextView) v.findViewById(R.id.story_domain);
-
- if (storyTitleView != null && storyItem.getTitle() != null)
- {
- storyTitleView.setText(storyItem.getTitle());
- storyTitleView.setVisibility(View.VISIBLE);
- }
-
- if (storyPostedWhenView != null && storyItem.getPostedDate() != null)
- {
- storyPostedWhenView.setText(storyItem.getPostedDate());
- storyPostedWhenView.setVisibility(View.VISIBLE);
- }
-
- if (storyDomainView != null && storyItem.getAuthor() != null)
- {
- storyDomainView.setText(storyItem.getAuthor());
- storyDomainView.setVisibility(View.VISIBLE);
- }
-
- Log.d(TAG, "Adding Header View");
- getListView().addHeaderView(v);
- }
-
- //get data and set listadapter
- downloadData();
- } else
- {
- Log.d(TAG, "getComments: invalid story id");
- setEmptyText("No data returned");
- }
- */
}
private void downloadData() {
@@ -277,7 +225,8 @@ private void addChildItems(CommentItem parent,
if (commentViewChild != null)
{
- commentViewChild.setText(childItem.getComment());
+ commentViewChild.setText(Html.fromHtml("<pre>ttt</pre>"));
+ //commentViewChild.setText(childItem.getComment());
int color = (parent.getColor() == Color.WHITE) ?
Color.LTGRAY :
Color.WHITE;
@@ -314,19 +263,6 @@ public View getView(int position, View convertView, ViewGroup parent)
Log.d(TAG, "getView: Position" + position);
try
{
- /*
- * View v;
- LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- if (convertView == null) {
- convertView = vi.inflate(R.layout.fragment_comments, null);
- v = convertView;
- convertView.setTag(v);
- } else
- {
- v = (View) convertView.getTag();
- }
- */
-
View v ;
LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null)
View
3  src/com/glebpopov/hackernews/fragments/CommentsFragmentView.java
@@ -17,6 +17,7 @@
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
+import android.text.Html;
import android.text.util.Linkify;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -268,6 +269,8 @@ public void run()
if (commentView != null)
{
+ //testing HTML formatting
+ //commentView.setText(Html.fromHtml(o.getComment() + "<br><i>i = 9;</i><br/><br/><i>t = 5;</i>"));
commentView.setText(o.getComment());
Linkify.addLinks(commentView, Linkify.ALL);
if (isNiteMode)
Please sign in to comment.
Something went wrong with that request. Please try again.