move share button to article fragment body; reinstate dreaded mark unread back to the freed space

This commit is contained in:
Andrew Dolgov 2015-06-02 00:00:14 +03:00
parent 56cb9c1eab
commit 1281e7dd42
10 changed files with 63 additions and 21 deletions

View File

@ -12,12 +12,10 @@ import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.text.Html; import android.text.Html;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -27,6 +25,7 @@ import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebView.HitTestResult; import android.webkit.WebView.HitTestResult;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
@ -264,6 +263,17 @@ public class ArticleFragment extends Fragment {
registerForContextMenu(title); registerForContextMenu(title);
} }
ImageView share = (ImageView)view.findViewById(R.id.share);
if (share != null) {
share.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
m_activity.shareArticle(m_article);
}
});
}
TextView comments = (TextView)view.findViewById(R.id.comments); TextView comments = (TextView)view.findViewById(R.id.comments);
if (comments != null) { if (comments != null) {

View File

@ -907,11 +907,11 @@ public class OnlineActivity extends CommonActivity {
dialog.show(); dialog.show();
} }
return true; return true;
case R.id.share_article: /* case R.id.share_article:
if (ap != null) { if (ap != null) {
shareArticle(ap.getSelectedArticle()); shareArticle(ap.getSelectedArticle());
} }
return true; return true; */
case R.id.toggle_marked: case R.id.toggle_marked:
if (ap != null & ap.getSelectedArticle() != null) { if (ap != null & ap.getSelectedArticle() != null) {
Article a = ap.getSelectedArticle(); Article a = ap.getSelectedArticle();

View File

@ -440,13 +440,13 @@ public class OfflineActivity extends CommonActivity {
} }
} }
return true; return true;
case R.id.share_article: /* case R.id.share_article:
if (true) { if (true) {
int articleId = oap.getSelectedArticleId(); int articleId = oap.getSelectedArticleId();
shareArticle(articleId); shareArticle(articleId);
} }
return true; return true; */
case R.id.toggle_marked: case R.id.toggle_marked:
if (oap != null) { if (oap != null) {
int articleId = oap.getSelectedArticleId(); int articleId = oap.getSelectedArticleId();

View File

@ -23,6 +23,7 @@ import android.view.ViewGroup;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebView.HitTestResult; import android.webkit.WebView.HitTestResult;
import android.widget.ImageView;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
@ -227,6 +228,18 @@ public class OfflineArticleFragment extends Fragment {
registerForContextMenu(title); registerForContextMenu(title);
} }
ImageView share = (ImageView)view.findViewById(R.id.share);
if (share != null) {
share.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
m_activity.shareArticle(m_articleId);
}
});
}
TextView comments = (TextView)view.findViewById(R.id.comments); TextView comments = (TextView)view.findViewById(R.id.comments);
if (comments != null) { if (comments != null) {

View File

@ -171,7 +171,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
} }
refresh(); refresh();
return true; return true;
case R.id.share_article: case R.id.headlines_share_article:
if (true) { if (true) {
int articleId = getArticleIdAtPosition(info.position); int articleId = getArticleIdAtPosition(info.position);
m_activity.shareArticle(articleId); m_activity.shareArticle(articleId);

View File

@ -40,15 +40,32 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="6dp"> android:paddingBottom="6dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="My simple headline" android:text="My simple but hilariously and excessively long headline"
android:textColor="?articleHeaderTextColor" android:textColor="?articleHeaderTextColor"
android:textSize="18sp" /> android:textSize="18sp" />
<ImageView
android:id="@+id/share"
android:background="@drawable/ripple"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_weight="0"
android:layout_marginLeft="8dp"
android:clickable="true"
android:src="?ic_share"
android:layout_gravity="center_vertical|right" />
</LinearLayout>
<TextView <TextView
android:id="@+id/comments" android:id="@+id/comments"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -83,13 +83,13 @@
<item <item
android:id="@+id/toggle_unread" android:id="@+id/toggle_unread"
android:icon="@drawable/ic_email" android:icon="@drawable/ic_email"
app:showAsAction="" app:showAsAction="ifRoom"
android:title="@string/article_toggle_unread"/> android:title="@string/article_toggle_unread"/>
<item <!-- <item
android:id="@+id/share_article" android:id="@+id/share_article"
android:icon="@drawable/ic_share" android:icon="@drawable/ic_share"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/share_article"/> android:title="@string/share_article"/> -->
<item <item
android:id="@+id/set_labels" android:id="@+id/set_labels"
app:showAsAction="" app:showAsAction=""

View File

@ -58,11 +58,11 @@
android:icon="@drawable/ic_email" android:icon="@drawable/ic_email"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/article_toggle_unread"/> --> android:title="@string/article_toggle_unread"/> -->
<item <!-- <item
android:id="@+id/share_article" android:id="@+id/share_article"
android:icon="@drawable/ic_share" android:icon="@drawable/ic_share"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/share_article"/> android:title="@string/share_article"/> -->
<item <item
android:id="@+id/catchup_above" android:id="@+id/catchup_above"
android:title="@string/article_mark_read_above"/> android:title="@string/article_mark_read_above"/>

View File

@ -34,4 +34,5 @@
<attr name="ic_checkbox_marked" format="reference" /> <attr name="ic_checkbox_marked" format="reference" />
<attr name="ic_star" format="reference" /> <attr name="ic_star" format="reference" />
<attr name="ic_star_outline" format="reference" /> <attr name="ic_star_outline" format="reference" />
<attr name="ic_share" format="reference" />
</resources> </resources>

View File

@ -42,6 +42,7 @@
<item name="ic_checkbox_marked">@drawable/ic_checkbox_marked_dark</item> <item name="ic_checkbox_marked">@drawable/ic_checkbox_marked_dark</item>
<item name="ic_star">@drawable/ic_star_dark</item> <item name="ic_star">@drawable/ic_star_dark</item>
<item name="ic_star_outline">@drawable/ic_star_outline_dark</item> <item name="ic_star_outline">@drawable/ic_star_outline_dark</item>
<item name="ic_share">@drawable/ic_share_dark</item>
</style> </style>
<style name="DarkTheme" parent="Theme.AppCompat"> <style name="DarkTheme" parent="Theme.AppCompat">
@ -86,7 +87,7 @@
<item name="ic_checkbox_marked">@drawable/ic_checkbox_marked</item> <item name="ic_checkbox_marked">@drawable/ic_checkbox_marked</item>
<item name="ic_star">@drawable/ic_star</item> <item name="ic_star">@drawable/ic_star</item>
<item name="ic_star_outline">@drawable/ic_star_outline</item> <item name="ic_star_outline">@drawable/ic_star_outline</item>
<item name="ic_share">@drawable/ic_share</item>
</style> </style>
<style name="DarkDialogTheme" parent="android:Theme"></style> <style name="DarkDialogTheme" parent="android:Theme"></style>