Skip to content

Commit

Permalink
search icon change, Mono search url fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
XunMengWinter committed Sep 24, 2018
1 parent 2e5a6a6 commit dd32654
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
4 changes: 0 additions & 4 deletions app/src/main/java/top/wefor/now/data/http/NowApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public static ZhihuApi getZhihuApi() {
return get(Urls.ZHIHU_NEWS).build().create(ZhihuApi.class);
}

// getDailyNewsContent GET
public static String getNewsContent(int id) {
return Urls.ZHIHU_DAILY_NEWS_CONTENT + id;
}

public static GankApi getGankApi() {
return get(Urls.GANK).build().create(GankApi.class);
Expand Down
13 changes: 12 additions & 1 deletion app/src/main/java/top/wefor/now/data/model/entity/TeaBean.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package top.wefor.now.data.model.entity;

import android.text.TextUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -67,10 +69,19 @@ public String getCover() {
return null;
}

public String getUrl() {
if (TextUtils.isEmpty(this.rec_url)) {
String webUrl = "http://mmmono.com/g/meow/{meow_id}/";
return webUrl.replace("{meow_id}", this.id);
} else {
return this.rec_url;
}
}

@Override
public NowItem toNow() {
NowItem nowItem = new NowItem();
nowItem.url = this.rec_url;
nowItem.url = getUrl();
nowItem.collectedDate = new Date().getTime();
nowItem.imageUrl = getCover();
nowItem.title = this.title;
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/top/wefor/now/data/model/entity/Zhihu.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Date;
import java.util.List;

import top.wefor.now.data.http.NowApi;
import top.wefor.now.data.http.Urls;

/**
* Created by tangqi on 8/20/15.
Expand All @@ -25,10 +25,14 @@ public class Zhihu implements Serializable, INow {
@SerializedName("multipic")
public boolean multipic;

public String getUrl() {
return Urls.ZHIHU_DAILY_NEWS_CONTENT + id;
}

@Override
public NowItem toNow() {
NowItem nowItem = new NowItem();
nowItem.url = NowApi.getNewsContent(this.id);
nowItem.url = getUrl();
nowItem.collectedDate = new Date().getTime();
nowItem.imageUrl = this.images.get(0);
nowItem.title = this.title;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/top/wefor/now/ui/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class MainActivity extends BaseCompatActivity {
@BindView(R.id.thanks_textView) TextView mThanksTextView;
@BindView(R.id.suggest_linearLayout) LinearLayout mSuggestLinearLayout;
@BindView(R.id.gank_textView) TextView mGankTextView;
@BindView(R.id.search_iv) AppCompatImageView mSearchIv;
@BindView(R.id.search_view) View mSearchView;


PreferencesHelper mPreferencesHelper = new PreferencesHelper(App.getInstance());
Expand Down Expand Up @@ -369,7 +369,7 @@ private void initDrawer() {
});

mGankTextView.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, GankDailyActivity.class)));
mSearchIv.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, SearchActivity.class)));
mSearchView.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, SearchActivity.class)));
}

private void setHeadImages(int index) {
Expand Down
16 changes: 2 additions & 14 deletions app/src/main/java/top/wefor/now/ui/fragment/MonoListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.res.Configuration;
import android.support.annotation.NonNull;
import android.text.TextUtils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -58,19 +57,8 @@ protected void initRecyclerView() {
mRecyclerView.setAdapter(scaleAdapter);

mAdapter.setOnItemClickListener(news -> {
if (!TextUtils.isEmpty(news.rec_url)) {
WebActivity.startThis(getActivity(), news.rec_url, news.title, news.getCover()
, getString(R.string.share_summary_mono));
// } else if (news.images != null && news.images.size() > 0) {
// startActivity(MonoImageListActivity.getIntent(getActivity(), news.images));
// } else if (news.pics != null && news.pics.size() > 0) {
// startActivity(MonoImageListActivity.getIntent(getActivity(), news.pics));
} else {
String webUrl = "http://mmmono.com/g/meow/{meow_id}/";
webUrl = webUrl.replace("{meow_id}", news.id);
WebActivity.startThis(getActivity(), webUrl, news.title, news.getCover()
, getString(R.string.share_summary_mono));
}
WebActivity.startThis(getActivity(), news.getUrl(), news.title, news.getCover()
, getString(R.string.share_summary_mono));
});

if (mList.size() < 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import android.os.Bundle;

import com.github.florent37.materialviewpager.MaterialViewPagerHelper;

import java.util.Calendar;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -62,12 +60,11 @@ protected void initRecyclerView() {
mRecyclerView.setAdapter(scaleAdapter);

mAdapter.setOnItemClickListener(news -> {
String news_url = NowApi.getNewsContent(news.id);
String imageUrl = null;
if (news.images != null && news.images.size() > 0)
imageUrl = news.images.get(0);

WebActivity.startThis(getActivity(), news_url, news.title, imageUrl,
WebActivity.startThis(getActivity(), news.getUrl(), news.title, imageUrl,
getString(R.string.share_summary_zhihu));
});

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_search_black_36dp.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="36dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="36dp">
<path android:fillColor="#1e3905" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
<path android:fillColor="#69694c" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_search_press_36dp.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="36dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="36dp">
<path android:fillColor="#99cc77" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
<path android:fillColor="#8b8c6c" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
16 changes: 10 additions & 6 deletions app/src/main/res/layout/drawer_other.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/other_rootView"
android:layout_width="320dp"
android:layout_height="match_parent"
Expand Down Expand Up @@ -171,13 +172,16 @@
android:textSize="@dimen/h5"/>
</LinearLayout>

<android.support.v7.widget.AppCompatImageView
android:id="@+id/search_iv"
<android.support.v7.widget.AppCompatTextView
android:id="@+id/search_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="@dimen/d4"
android:src="@drawable/selector_search_btn"/>

android:layout_gravity="end"
android:layout_marginEnd="@dimen/d3"
android:padding="@dimen/d3"
android:text="🔍"
android:textSize="24sp"
tools:ignore="HardcodedText"/>
<!--android:src="@drawable/selector_search_btn"-->

</LinearLayout>

0 comments on commit dd32654

Please sign in to comment.