parent
06b5ae50fa
commit
5fcb00da5e
|
@ -81,5 +81,7 @@ dependencies {
|
|||
implementation 'jp.wasabeef:glide-transformations:2.0.1'
|
||||
implementation 'com.timqi.collapsibletextview:library:1.1.2'
|
||||
// implementation 'com.ms-square:expandableTextView:0.1.4'
|
||||
// implementation 'com.github.tangguna:SearchBox:1.0.1'
|
||||
implementation 'com.github.chengzipi:Searchbox:v1.0.0'
|
||||
|
||||
}
|
||||
|
|
|
@ -42,30 +42,17 @@
|
|||
android:launchMode="singleTask"
|
||||
android:parentActivityName=".Main2Activity"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".Main7Activity"
|
||||
android:label="@string/title_activity_main7"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".Activity_paihangbang" />
|
||||
<!-- meta tag and intent filter go into results activity -->
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/searchable" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ScrollingActivity"
|
||||
android:label="@string/title_activity_scrolling"
|
||||
android:name=".Activity_Search"
|
||||
android:label="@string/title_activity_cates"
|
||||
android:launchMode="singleTask"
|
||||
android:parentActivityName=".Main2Activity"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".Main6Activity"
|
||||
android:label="@string/title_activity_main6"
|
||||
android:parentActivityName=".Main2Activity"
|
||||
|
||||
android:name=".ScrollingActivity"
|
||||
android:label="@string/title_activity_scrolling"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".Activity_paihangbang"
|
||||
|
@ -93,7 +80,7 @@
|
|||
<activity
|
||||
android:name=".Main2Activity"
|
||||
|
||||
android:launchMode="singleTop"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package com.novelbook.android;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.czp.searchmlist.mSearchLayout;
|
||||
import com.novelbook.android.utils.HistoryCache;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class Activity_Search extends AppCompatActivity {
|
||||
|
||||
|
||||
@BindView(R.id.msearchlayout)
|
||||
mSearchLayout searchLayout;
|
||||
// SearchLayout searchLayout;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_search);
|
||||
ButterKnife.bind(this);
|
||||
initialSearch();
|
||||
}
|
||||
|
||||
|
||||
void initialSearch() {
|
||||
|
||||
List<String> skills = HistoryCache.toArray(getApplicationContext());
|
||||
String shareHotData ="武动乾坤,校花高手,苍穹"; //TODO get hot keys from host
|
||||
List<String> skillHots = Arrays.asList(shareHotData.split(","));
|
||||
this.searchLayout.initData(skills, skillHots, new mSearchLayout.setSearchCallBackListener() {
|
||||
public void Search(String str) {
|
||||
//进行或联网搜索 str搜索关键词
|
||||
Intent intent = new Intent(Activity_Search.this, Activity_paihangbang.class);
|
||||
intent.putExtra(Activity_paihangbang.EXTR_SEARCH,str);
|
||||
intent.putExtra(Activity_paihangbang.EXTR_TITLE,"搜索小说:" + str );
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void Back() {
|
||||
//取消搜索
|
||||
finish();
|
||||
}
|
||||
|
||||
public void ClearOldData() {
|
||||
//清除历史搜索记录 执行更新本地 原始历史搜索数据
|
||||
}
|
||||
|
||||
public void SaveOldData(ArrayList<String> AlloldDataList) {
|
||||
//保存所有历史搜索数据 请保保存以便下次使用
|
||||
HistoryCache.saveHistory(getApplicationContext(),HistoryCache.toJsonArray(AlloldDataList));
|
||||
Log.e("点击","保存数据");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -29,6 +30,7 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
public static String EXTR_FN="fn";
|
||||
public static String EXTR_TITLE="title";
|
||||
public static String EXTR_BANGDAN ="bangdan";
|
||||
public static final String EXTR_SEARCH ="search";
|
||||
private ArrayList<Fragment> mFragments;
|
||||
ArrayList<View> mList;
|
||||
String[] mTitle;
|
||||
|
@ -45,6 +47,7 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
|
||||
String bangdan;
|
||||
String fn;
|
||||
String keyword;
|
||||
@Override
|
||||
protected void setTitle() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
|
@ -57,6 +60,7 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
bangdan = getIntent().getStringExtra(EXTR_BANGDAN);
|
||||
|
||||
String title = getIntent().getStringExtra(EXTR_TITLE);
|
||||
keyword = getIntent().getStringExtra(EXTR_SEARCH);
|
||||
|
||||
|
||||
//title+="榜";
|
||||
|
@ -76,10 +80,12 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
if(mFragments ==null || mFragments.size() ==0){
|
||||
// mTitle = new String[]{"周榜", "月榜", "总榜"};
|
||||
mFragments = new ArrayList<>();
|
||||
mFragments.add( Fragment_booklist.newInstance(fn,bangdan)); //首页更多
|
||||
|
||||
|
||||
if(!TextUtils.isEmpty(keyword)){
|
||||
mFragments.add( Fragment_booklist.search(keyword)); //搜索
|
||||
|
||||
}else {
|
||||
mFragments.add(Fragment_booklist.newInstance(fn, bangdan)); //首页更多
|
||||
}
|
||||
|
||||
|
||||
// mFragments.add(new Fragment_booklist());
|
||||
|
@ -109,49 +115,8 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
||||
mViewpager.setCurrentItem(0);
|
||||
}
|
||||
//---search option
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_search, menu);
|
||||
// Get the SearchView and set the searchable configuration
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
|
||||
// Assumes current activity is the searchable activity
|
||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
|
||||
|
||||
/*searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
Log.i(TAG,query);
|
||||
Toast.makeText(Activity_paihangbang.this,query,Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
*/
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,18 @@ public class Config {
|
|||
private float light = 0;
|
||||
private int bookBG;
|
||||
|
||||
public int getSexOption() {
|
||||
return sp.getInt(SEX_OPTION_KEY,sexOption);
|
||||
}
|
||||
|
||||
public void setSexOption(int sexOption) {
|
||||
sp.edit().putInt(SEX_OPTION_KEY,sexOption).commit();
|
||||
}
|
||||
|
||||
//sexoption
|
||||
public final static String SEX_OPTION_KEY="sexoption";
|
||||
private int sexOption =1;
|
||||
|
||||
private Config(Context mContext){
|
||||
this.mContext = mContext.getApplicationContext();
|
||||
sp = this.mContext.getSharedPreferences(SP_NAME,Context.MODE_PRIVATE);
|
||||
|
|
|
@ -202,14 +202,20 @@ public abstract class BasicFragment extends Fragment {
|
|||
}else {
|
||||
nv.save();
|
||||
}
|
||||
Log.d(TAG, String.format("prepare book %s 开始prepare.",nv.getName()) );
|
||||
// final Novel novel = nv;
|
||||
/* new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
|
||||
}
|
||||
}.start();*/
|
||||
|
||||
PageFactory.getInstance().prepareBook(nv ); //打开本地小说内容
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ReadActivity.openBook(novel ,activity);
|
||||
|
||||
Log.d(TAG, String.format("prepare book %s 开始open book.",nv.getName()) );
|
||||
ReadActivity.openBook(nv ,activity);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import butterknife.BindView;
|
|||
public class Fragment_booklist extends BasicFragment {
|
||||
private static final String EXTR_CATE ="cate" ;
|
||||
private static final String EXTR_PROGRESS ="progress" ;
|
||||
|
||||
private static final String EXTR_SEARCH ="search";
|
||||
private static final String EXTR_FN ="fn" ;
|
||||
private static final String EXTR_BANGDAN ="bangdan" ;
|
||||
private BookListAdapter mAdapter;
|
||||
|
@ -44,7 +44,7 @@ public class Fragment_booklist extends BasicFragment {
|
|||
private List<Novel> mData;;
|
||||
private String cate;
|
||||
private int progress;
|
||||
|
||||
private String keyWord;
|
||||
private String fn;
|
||||
private String bangdan;
|
||||
|
||||
|
@ -73,6 +73,15 @@ public class Fragment_booklist extends BasicFragment {
|
|||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
public static Fragment_booklist search(String keyWord) {
|
||||
Fragment_booklist fragment = new Fragment_booklist();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(EXTR_SEARCH,keyWord);
|
||||
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
protected void processArguments(){
|
||||
if (getArguments() != null) {
|
||||
Bundle bundle = getArguments() ;
|
||||
|
@ -84,8 +93,7 @@ public class Fragment_booklist extends BasicFragment {
|
|||
}
|
||||
cate = bundle.getString(EXTR_CATE);
|
||||
progress = bundle.getInt(EXTR_PROGRESS);
|
||||
|
||||
|
||||
keyWord =bundle.getString(EXTR_SEARCH);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -124,15 +132,40 @@ public class Fragment_booklist extends BasicFragment {
|
|||
return R.layout.fragment_fragment_booklist;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
showProgressDialog(true, "正在加载");
|
||||
OnSuccessAndFaultListener successAndFaultListener = new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||
try {
|
||||
|
||||
mData = GsonUtil. parserJsonArray(result,Constants.BLOCK_TITLE_NOVELS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
handler.sendEmptyMessage(1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMsg) {
|
||||
//失败
|
||||
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Log.d(TAG,String.format("fn is %s",fn) );
|
||||
|
||||
if(!TextUtils.isEmpty(bangdan) && !TextUtils.isEmpty(fn)){ //榜单
|
||||
|
||||
showProgressDialog(true, "正在加载榜单");
|
||||
BookSubscribe.getSiteRankDetail(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
@ -159,59 +192,18 @@ public class Fragment_booklist extends BasicFragment {
|
|||
|
||||
|
||||
}else if(!TextUtils.isEmpty(fn)){ //首页 更多
|
||||
|
||||
BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||
try {
|
||||
|
||||
mData = GsonUtil. parserJsonArray(result,Constants.BLOCK_TITLE_NOVELS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
handler.sendEmptyMessage(1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMsg) {
|
||||
//失败
|
||||
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
}, getActivity()));
|
||||
|
||||
|
||||
showProgressDialog(true, "正在加载更多");
|
||||
BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
|
||||
}
|
||||
else if(!TextUtils.isEmpty((cate))) { //分类
|
||||
showProgressDialog(true, "正在加载分类");
|
||||
BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, progress, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
|
||||
else
|
||||
|
||||
|
||||
BookSubscribe.getCateNovelList(cate,pageNo,Constants.SEX,progress,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||
try {
|
||||
|
||||
mData = GsonUtil. parserJsonArray(result,Constants.BLOCK_TITLE_NOVELS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
handler.sendEmptyMessage(1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMsg) {
|
||||
//失败
|
||||
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
}, getActivity()));
|
||||
}else if(!TextUtils.isEmpty(keyWord)){ //搜索
|
||||
showProgressDialog(true, "正在加载搜索");
|
||||
BookSubscribe.getSearchNovelList( keyWord,pageNo, Constants.SEX, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -54,7 +55,7 @@ public class Main2Activity extends Activity_base
|
|||
BottomNavigationView botoomNavigation;
|
||||
@BindView(R.id.rgSex)
|
||||
RadioGroup rgSex;
|
||||
|
||||
private Config config;
|
||||
@Override
|
||||
public int getLayoutRes() {
|
||||
return R.layout.activity_main2;
|
||||
|
@ -70,13 +71,23 @@ public class Main2Activity extends Activity_base
|
|||
super.onCreate(savedInstanceState);
|
||||
app =(MyApp) getApplicationContext();
|
||||
// requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
|
||||
config =Config.getInstance();
|
||||
// ButterKnife.bind(this);
|
||||
|
||||
initialSexOption();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void initialSexOption(){
|
||||
Constants.SEX = config.getSexOption();
|
||||
rgSex.clearCheck();
|
||||
// ((RadioButton) rgSex.getChildAt(0)).setChecked(Constants.SEX ==1);
|
||||
// ((RadioButton) rgSex.getChildAt(1)).setChecked(Constants.SEX ==2);
|
||||
((RadioButton) rgSex.getChildAt(Constants.SEX-1)).setChecked(true);
|
||||
Log.d(TAG, "onCreate: sexoption is" + Constants.SEX);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setTitle() {
|
||||
setTitle("");
|
||||
|
@ -150,6 +161,10 @@ public class Main2Activity extends Activity_base
|
|||
}
|
||||
else if(menuItemId == R.id.menuFinshi) {
|
||||
udateShelfZhengli();
|
||||
} if(menuItemId==R.id.menuSearch){
|
||||
Intent intent = new Intent(Main2Activity.this,Activity_Search.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -204,14 +219,14 @@ public class Main2Activity extends Activity_base
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) menu.findItem(R.id.menuSearch).getActionView();
|
||||
// SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
// SearchView searchView = (SearchView) menu.findItem(R.id.menuSearch).getActionView();
|
||||
// Assumes current activity is the searchable activity
|
||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
|
||||
// searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
|
@ -222,9 +237,14 @@ public class Main2Activity extends Activity_base
|
|||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
if(id==R.id.menuSearch){
|
||||
Intent intent = new Intent(this,Activity_Search.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}*/
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
|
@ -418,33 +438,29 @@ private int bottomSelectedIndex;
|
|||
|
||||
}
|
||||
|
||||
private void setSexOption(){
|
||||
int s = rgSex.getCheckedRadioButtonId() == R.id.radioButtonBoy ?1:2;
|
||||
if(s!= Constants.SEX){
|
||||
Constants.SEX=s;
|
||||
config.setSexOption(s);
|
||||
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
||||
if (current != null && current instanceof BasicFragment){
|
||||
((BasicFragment)current).reload();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick({R.id.radioButtonBoy,R.id.radioButtonGirl})
|
||||
void Onclick(View view){
|
||||
int s;
|
||||
|
||||
switch (view.getId()) {
|
||||
case R.id.radioButtonBoy:
|
||||
s = rgSex.getCheckedRadioButtonId() == R.id.radioButtonBoy ?1:0;
|
||||
if(s!= Constants.SEX){
|
||||
Constants.SEX=s;
|
||||
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
||||
if (current != null && current instanceof BasicFragment){
|
||||
((BasicFragment)current).reload();
|
||||
}
|
||||
|
||||
}
|
||||
setSexOption();
|
||||
break;
|
||||
case R.id.radioButtonGirl:
|
||||
s = rgSex.getCheckedRadioButtonId() == R.id.radioButtonBoy ?1:0;
|
||||
if(s!= Constants.SEX){
|
||||
Constants.SEX=s;
|
||||
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
||||
if (current != null && current instanceof BasicFragment){
|
||||
((BasicFragment)current).reload();
|
||||
}
|
||||
|
||||
}
|
||||
setSexOption();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
package com.novelbook.android;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Main3Activity extends AppCompatActivity {
|
||||
|
||||
private TextView mTextMessage;
|
||||
|
||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||
= new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.navigation_home:
|
||||
mTextMessage.setText(R.string.title_home);
|
||||
return true;
|
||||
case R.id.navigation_dashboard:
|
||||
mTextMessage.setText(R.string.title_dashboard);
|
||||
return true;
|
||||
case R.id.navigation_notifications:
|
||||
mTextMessage.setText(R.string.title_notifications);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main3);
|
||||
|
||||
mTextMessage = (TextView) findViewById(R.id.message);
|
||||
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package com.novelbook.android;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class Main4Activity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main4);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
});
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawer.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main4, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem item) {
|
||||
// Handle navigation view item clicks here.
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.nav_camera) {
|
||||
// Handle the camera action
|
||||
} else if (id == R.id.nav_gallery) {
|
||||
|
||||
} else if (id == R.id.nav_slideshow) {
|
||||
|
||||
} else if (id == R.id.nav_manage) {
|
||||
|
||||
} else if (id == R.id.nav_share) {
|
||||
|
||||
} else if (id == R.id.nav_send) {
|
||||
|
||||
}
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package com.novelbook.android;
|
||||
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Main6Activity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* The {@link android.support.v4.view.PagerAdapter} that will provide
|
||||
* fragments for each of the sections. We use a
|
||||
* {@link FragmentPagerAdapter} derivative, which will keep every
|
||||
* loaded fragment in memory. If this becomes too memory intensive, it
|
||||
* may be best to switch to a
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
/**
|
||||
* The {@link ViewPager} that will host the section contents.
|
||||
*/
|
||||
private ViewPager mViewPager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main6);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
// Create the adapter that will return a fragment for each of the three
|
||||
// primary sections of the activity.
|
||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
mViewPager = (ViewPager) findViewById(R.id.container);
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_main6, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public static class PlaceholderFragment extends Fragment {
|
||||
/**
|
||||
* The fragment argument representing the section number for this
|
||||
* fragment.
|
||||
*/
|
||||
private static final String ARG_SECTION_NUMBER = "section_number";
|
||||
|
||||
public PlaceholderFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section
|
||||
* number.
|
||||
*/
|
||||
public static PlaceholderFragment newInstance(int sectionNumber) {
|
||||
PlaceholderFragment fragment = new PlaceholderFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_main6, container, false);
|
||||
TextView textView = (TextView) rootView.findViewById(R.id.section_label);
|
||||
textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
*/
|
||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// getItem is called to instantiate the fragment for the given page.
|
||||
// Return a PlaceholderFragment (defined as a static inner class below).
|
||||
return PlaceholderFragment.newInstance(position + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// Show 3 total pages.
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
package com.novelbook.android;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class Main7Activity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* The {@link android.support.v4.view.PagerAdapter} that will provide
|
||||
* fragments for each of the sections. We use a
|
||||
* {@link FragmentPagerAdapter} derivative, which will keep every
|
||||
* loaded fragment in memory. If this becomes too memory intensive, it
|
||||
* may be best to switch to a
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
/**
|
||||
* The {@link ViewPager} that will host the section contents.
|
||||
*/
|
||||
private ViewPager mViewPager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// if (android.os.Build.VERSION.SDK_INT >= 21)
|
||||
{
|
||||
//解决Android5.0以上,状态栏设置颜色后变灰的问题
|
||||
|
||||
// getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||
try {
|
||||
Class decorViewClazz = Class.forName("com.android.internal.policy.DecorView");
|
||||
Field field = decorViewClazz.getDeclaredField("mSemiTransparentStatusBarColor");
|
||||
field.setAccessible(true);
|
||||
field.setInt(getWindow().getDecorView(), Color.TRANSPARENT); //设置透明
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
setContentView(R.layout.activity_main7);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
// Create the adapter that will return a fragment for each of the three
|
||||
// primary sections of the activity.
|
||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
mViewPager = (ViewPager) findViewById(R.id.container);
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_main7, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public static class PlaceholderFragment extends Fragment {
|
||||
/**
|
||||
* The fragment argument representing the section number for this
|
||||
* fragment.
|
||||
*/
|
||||
private static final String ARG_SECTION_NUMBER = "section_number";
|
||||
|
||||
public PlaceholderFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section
|
||||
* number.
|
||||
*/
|
||||
public static PlaceholderFragment newInstance(int sectionNumber) {
|
||||
PlaceholderFragment fragment = new PlaceholderFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_main7, container, false);
|
||||
TextView textView = (TextView) rootView.findViewById(R.id.section_label);
|
||||
textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
*/
|
||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// getItem is called to instantiate the fragment for the given page.
|
||||
// Return a PlaceholderFragment (defined as a static inner class below).
|
||||
return PlaceholderFragment.newInstance(position + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// Show 3 total pages.
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package com.novelbook.android;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private TextView mTextMessage;
|
||||
|
||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||
= new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.navigation_home:
|
||||
mTextMessage.setText(R.string.title_home);
|
||||
return true;
|
||||
case R.id.navigation_dashboard:
|
||||
mTextMessage.setText(R.string.title_dashboard);
|
||||
return true;
|
||||
case R.id.navigation_notifications:
|
||||
mTextMessage.setText(R.string.title_notifications);
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.maintest);
|
||||
// creatToolbar();
|
||||
// mTextMessage = (TextView) findViewById(R.id.message);
|
||||
// BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
||||
// navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
private void creatToolbar() {
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
//setSupportActionBar(toolbar);
|
||||
// toolbar.setNavigationIcon(R.mipmap.ic_launcher_round);//设置导航栏图标
|
||||
// toolbar.setLogo(R.mipmap.ic_launcher);//设置app logo
|
||||
toolbar.setTitle("Title");//设置主标题
|
||||
setTitle("title");
|
||||
toolbar.setSubtitle("Subtitle");//设置子标题
|
||||
|
||||
toolbar.inflateMenu(R.menu.main);//设置右上角的填充菜单
|
||||
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
int menuItemId = item.getItemId();
|
||||
if (menuItemId == R.id.menuFenlei) {
|
||||
Toast.makeText( MainActivity.this , R.string.test , Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -63,9 +63,9 @@ public class CatalogueAdapter extends BaseAdapter {
|
|||
viewHolder = (ViewHolder)convertView.getTag();
|
||||
}
|
||||
if (currentCharter == position){
|
||||
viewHolder.catalogue_tv.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
|
||||
viewHolder.catalogue_tv.setTextColor(mContext.getResources().getColor(R.color.colorPrimaryDark));
|
||||
}else{
|
||||
viewHolder.catalogue_tv.setTextColor(mContext.getResources().getColor(R.color.read_textColor));
|
||||
viewHolder.catalogue_tv.setTextColor(mContext.getResources().getColor(R.color.colorPrimaryDark));
|
||||
}
|
||||
viewHolder.catalogue_tv.setText(bookCatalogueList.get(position).getChapterName());
|
||||
//Log.d("catalogue",bookCatalogueList.get(position).getBookCatalogue());
|
||||
|
|
|
@ -142,10 +142,14 @@ public class Novel extends LitePalSupport implements Serializable{
|
|||
}
|
||||
|
||||
public int getLastReadChapt() {
|
||||
if(lastReadChapt<=0){
|
||||
lastReadChapt=1;
|
||||
}
|
||||
return lastReadChapt;
|
||||
}
|
||||
|
||||
public void setLastReadChapt(int lastReadChapt) {
|
||||
lastReadChapt = lastReadChapt >0 ? lastReadChapt :1;
|
||||
this.lastReadChapt = lastReadChapt;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,9 @@ public interface HttpApi {
|
|||
//http://xiaoshuofenxiang.com/api/page/siterank?fn=qidian-yuanchuangfengyunbang&pn=3
|
||||
@GET("page/siterank?fn=qidian-yuanchuangfengyunbang&pn=3")
|
||||
Observable<ResponseBody> getSiteRankDetail(@Query("fn")String fn,@Query("pn")int pageNo,@Query("sex") int Sex);
|
||||
@GET( "search/{keyword}/{pageno}")
|
||||
Observable<ResponseBody> getSeachNolvelist(@Path("keyword")String keyWord,@Path("pageno")int pageNo,@Query("sex") int Sex);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -67,4 +67,10 @@ public class BookSubscribe {
|
|||
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getSiteRankDetail(fn,pageNo,sex);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
|
||||
public static void getSearchNovelList( String keyWord,int pageNo,int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getSeachNolvelist(keyWord,pageNo,sex);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,8 +117,11 @@ public class BookUtil {
|
|||
public void setNovelSites(NovelSites nvs) {
|
||||
|
||||
this.mNovelSites = nvs;
|
||||
|
||||
Log.d(TAG, String.format("prepare book %s get novel sites count .",nvs.getSites().length) );
|
||||
if(nvs.getSites().length ==0){
|
||||
return;
|
||||
throw new RuntimeException("书本错误 code 001"); //无目标网站
|
||||
// return;
|
||||
}
|
||||
mSite =nvs.getSites()[0];
|
||||
if(nvs.getSites().length > 0)
|
||||
|
@ -148,11 +151,13 @@ public class BookUtil {
|
|||
public void onSuccess(String result) {
|
||||
//成功
|
||||
try {
|
||||
Log.d(TAG, String.format("prepare book %s get target sites done.",mNovel.getName()) );
|
||||
|
||||
NovelSites nvs = (NovelSites) gson.fromJson(result,NovelSites.class);
|
||||
//pageFactory.prepareBook(mNovel,nvs, BookActivity.this);
|
||||
setNovelSites(nvs);
|
||||
|
||||
|
||||
} catch ( Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -186,6 +191,8 @@ public class BookUtil {
|
|||
}
|
||||
mSiteRule =sr;
|
||||
setSiteInfo();
|
||||
Log.d(TAG, String.format("prepare book %s 目录正则表达式下载完成,开始读章节信息.",mNovel.getName()) );
|
||||
|
||||
Log.d(TAG, String.format("目录正则表达式下载完成,开始读取章节信息") );
|
||||
|
||||
readChaptersAsync();
|
||||
|
@ -212,9 +219,19 @@ public class BookUtil {
|
|||
|
||||
public void setChapterNo(int chapterNo) {
|
||||
this.chapterNo = chapterNo;
|
||||
/*
|
||||
if(chapterNo <= mChapters.size()) {
|
||||
this.chapterNo = chapterNo;
|
||||
}else{
|
||||
Log.d(TAG, String.format("setChapterNo: wrong chapno for book %s,site %s,total chapts %s,chaptNo %s" ,mNovel.getName(),mNovel.getDomain(),getChapters().size(),chapterNo));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public int getChapterNo() {
|
||||
if(chapterNo > mChapters.size()){
|
||||
chapterNo =1;
|
||||
}
|
||||
return chapterNo;
|
||||
}
|
||||
|
||||
|
@ -233,6 +250,11 @@ public class BookUtil {
|
|||
|
||||
}
|
||||
|
||||
public boolean isBusy() {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
enum MuluStatus{
|
||||
isDownloading,
|
||||
isDone,
|
||||
|
@ -291,10 +313,10 @@ public class BookUtil {
|
|||
}else{ //读取目录列表
|
||||
MuluStatus m = mMuluStatus;
|
||||
// Log.d(TAG,String.format("mulu on Site %s download status %s",mSite.getDomain(),mMuluStatus));
|
||||
|
||||
while(mMuluStatus == MuluStatus.isDownloading){
|
||||
Log.d(TAG, String.format("prepare book %s open book in background.... mMuluStatus %s,mSiteRule %s",mNovel.getName(),mMuluStatus,mSiteRule) );
|
||||
while(mSiteRule ==null || mMuluStatus == MuluStatus.isDownloading){
|
||||
Thread.sleep(50);
|
||||
Log.d(TAG,String.format("waiting for mulu downloading ,mMuluStatus %s" ,mMuluStatus));
|
||||
Log.d(TAG,String.format("prepare book waiting for mulu downloading ,mMuluStatus %s,msiteRule %s" ,mMuluStatus,mSiteRule));
|
||||
if(mMuluStatus == MuluStatus.failed){
|
||||
dismissProgressDialog();
|
||||
throw new RuntimeException("读取资源失败,请检查网络");
|
||||
|
@ -378,16 +400,16 @@ public class BookUtil {
|
|||
return;
|
||||
}
|
||||
if (body != null) {
|
||||
|
||||
Log.d(TAG, String.format("prepare book %s 章节信息读取成功.",mNovel.getName()) );
|
||||
try {
|
||||
String bodyStr = body.string();
|
||||
// Log.d(TAG, "onResponse: " +bodyStr);
|
||||
// Log.d(TAG,String.format("loadChaptContent----end download %s 目录, 目录数量 %s, cost %s", mNovel.getName() , mChapters.size(), new Date().getTime() -startTime ));
|
||||
// long startTime2= new Date().getTime();
|
||||
buildCharacters(bodyStr,url);
|
||||
Log.d(TAG,String.format("loadChaptContent----end download %s 目录, 目录数量 %s, cost %s", mNovel.getName() , mChapters.size(), new Date().getTime() -startTime ));
|
||||
buildChapters(bodyStr,url);
|
||||
Log.d(TAG,String.format("loadChapts----end download %s 目录, 目录数量 %s, cost %s", mNovel.getName() , mChapters.size(), new Date().getTime() -startTime ));
|
||||
mMuluStatus = MuluStatus.isDone;
|
||||
|
||||
Log.d(TAG, String.format("prepare book %s 章节信息完成.",mNovel.getName()) );
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -400,7 +422,7 @@ public class BookUtil {
|
|||
}
|
||||
});
|
||||
}
|
||||
void buildCharacters( String content ,String url){
|
||||
void buildChapters( String content ,String url){
|
||||
|
||||
try {
|
||||
JSONObject siteJson = new JSONObject();
|
||||
|
@ -513,14 +535,14 @@ public class BookUtil {
|
|||
return line.toCharArray();
|
||||
}
|
||||
public char chaptCurrent(){
|
||||
|
||||
chapterNo = mChapters.size() <= chapterNo ? 1 : chapterNo;
|
||||
|
||||
char[] charArray = chaptChars(chapterNo);
|
||||
|
||||
|
||||
|
||||
|
||||
return charArray[(int)position-1];
|
||||
int i = (int)position-1;
|
||||
i = i<= charArray.length? i:charArray.length;
|
||||
return charArray[i];
|
||||
}
|
||||
public char current(){
|
||||
// int pos = (int) (position % cachedSize);
|
||||
|
@ -855,7 +877,7 @@ public class BookUtil {
|
|||
success
|
||||
}
|
||||
//获取chapter 缓存
|
||||
public char[] chaptChars(int index) {
|
||||
public char[] chaptChars(final int index) {
|
||||
char[] block=null;
|
||||
if(chaptCache.containsKey(Integer.valueOf(index))) {
|
||||
block = chaptCache .get(index).getData().get();
|
||||
|
@ -867,19 +889,25 @@ public class BookUtil {
|
|||
|
||||
if(!file.exists()) {
|
||||
|
||||
if(mMuluStatus ==null){
|
||||
Log.d(TAG,String.format("prepare book loadChapts---- 还未有目录信息,出错了 %s 目录, 目录数量 %s, MuluStatus %s", mNovel.getName() , mChapters.size(), mMuluStatus ));
|
||||
getTargetSites();
|
||||
}
|
||||
int slept = 0;
|
||||
while(slept <100 && mMuluStatus ==MuluStatus.isDownloading){
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
slept++;
|
||||
Log.d(TAG,String.format("prepare book loadChapts----等待中 %s 目录, 目录数量 %s, slept %s, MuluStatus %s", mNovel.getName() , mChapters.size(),slept ,mMuluStatus ));
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if( mChapters ==null || mChapters.size() ==0){
|
||||
|
||||
String error = "获取目录失败,网络错误,请重试";
|
||||
Log.d(TAG,String.format("loadChapts----超时。。。或出错了 %s 目录, 目录数量 %s, slept %s, MuluStatus %s", mNovel.getName() , mChapters.size(),slept ,mMuluStatus ));
|
||||
String error = "获取目录失败,网络错误,请重试. " +mMuluStatus;
|
||||
return error.toCharArray();
|
||||
}
|
||||
|
||||
|
@ -901,10 +929,10 @@ public class BookUtil {
|
|||
int slepttime =0;
|
||||
// while(!file.exists() && !getDownloadStatus()){//&& slepttime <maxSleep){
|
||||
// while( !getDownloadStatus() && slepttime <maxSleep){
|
||||
while( chaptDownStatus.get(Integer.valueOf(index)) == DownloadStatus.downloading && slepttime <maxSleep){
|
||||
while( !getDownloadStatus() && chaptDownStatus.get(Integer.valueOf(index)) == DownloadStatus.downloading && slepttime <maxSleep){
|
||||
Thread.sleep(50);
|
||||
slepttime+=50;
|
||||
// Log.d("loadChaptContent",String.format("loadChaptContent slept %s for downloading,isDownload %s ",slepttime,getDownloadStatus() ) );
|
||||
Log.d(TAG,String.format(" prepare book loadChaptContent slept %s for downloading,isDownload %s ",slepttime,getDownloadStatus() ) );
|
||||
}
|
||||
Log.d("loadChaptContent",String.format("loadChaptContent slept %s for downloading ",slepttime ) );
|
||||
Log.d( "loadChaptContent",String.format("dismissing dialog " ));
|
||||
|
@ -914,7 +942,7 @@ public class BookUtil {
|
|||
Log.d( "loadChaptContent",String.format(" %s, file.exists()? %s", file.getPath(),file.exists()));
|
||||
if(!file.exists()) {
|
||||
|
||||
String error = "==";
|
||||
String error = "网络不给力";
|
||||
return error.toCharArray();
|
||||
}
|
||||
if(mChapters.size() > index ) {
|
||||
|
@ -962,13 +990,17 @@ public class BookUtil {
|
|||
return block;
|
||||
}
|
||||
|
||||
private void loadChaptContent(int index) throws JSONException, InterruptedException {
|
||||
private void loadChaptContent(final int chapterIndex) throws JSONException, InterruptedException {
|
||||
/* 章节内容没有缓存在本地
|
||||
1. 根据本地的章节网络地址信息,读取章节内容到本地,若读取失败则
|
||||
2. 查询主服务器,若有地址更新则更新本地信息,并重复1,若没有更新地址,则地址无效,返回章节内容正待手打
|
||||
*/
|
||||
//
|
||||
final int index = mChapters.size() <= chapterIndex ? 1 : chapterIndex;
|
||||
if(mChapters.size() <chapterIndex){
|
||||
Log.d(TAG,String.format("loadChaptContent----wrong index, chapter size %s,load index %s,bookname %s", mChapters.size(),index,mNovel.getName() ));
|
||||
|
||||
}
|
||||
Chapter chapter = mChapters.get(index -1);
|
||||
String url = chapter.getChapterUrl();
|
||||
if( TextUtils.isEmpty( url)){
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.novelbook.android.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.util.List;
|
||||
|
||||
public class HistoryCache {
|
||||
public HistoryCache() {
|
||||
}
|
||||
|
||||
public static void clear(Context context) {
|
||||
SharedPreferences sp = context.getSharedPreferences("record", 0);
|
||||
sp.edit().clear().commit();
|
||||
}
|
||||
|
||||
public static void saveHistory(Context context, String result) {
|
||||
SharedPreferences sp = context.getSharedPreferences("record", 0);
|
||||
Editor editor = sp.edit();
|
||||
editor.putString("record_key", result);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static String getHistory(Context context) {
|
||||
SharedPreferences sp = context.getSharedPreferences("record", 0);
|
||||
String result = sp.getString("record_key", (String)null);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<String> toArray(Context context) {
|
||||
String history = getHistory(context);
|
||||
Gson gson = new Gson();
|
||||
List<String> retList = (List)gson.fromJson(history, (new TypeToken<List<String>>() {
|
||||
}).getType());
|
||||
return retList;
|
||||
}
|
||||
|
||||
public static String toJsonArray(List<String> historyList) {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(historyList);
|
||||
}
|
||||
}
|
|
@ -166,7 +166,9 @@ public class PageFactory {
|
|||
private List<TRPage> loadCurrentChapt(int chaptId){
|
||||
List<TRPage> chaptPages = new ArrayList<TRPage>();
|
||||
|
||||
chaptId = mChapters!=null && mChapters.size() <= chaptId ? 1 : chaptId;
|
||||
|
||||
Log.d(TAG, String.format("prepare book to open chapter %s ",chaptId ) );
|
||||
char[] chars = mBookUtil.chaptChars(chaptId);
|
||||
|
||||
mBookUtil.setBookLen(chars.length);
|
||||
|
@ -495,6 +497,9 @@ public class PageFactory {
|
|||
if(null == currentPage){
|
||||
return;
|
||||
}
|
||||
if(mBookUtil.isBusy()){
|
||||
return;
|
||||
}
|
||||
m_isfirstPage = false;
|
||||
if (currentPage.getBegin() <= 1) {
|
||||
Log.d(TAG,"当前是本章第一页");
|
||||
|
@ -517,6 +522,10 @@ public class PageFactory {
|
|||
if(null == currentPage){
|
||||
return;
|
||||
}
|
||||
if(mBookUtil.isBusy()){
|
||||
return;
|
||||
}
|
||||
|
||||
m_islastPage = false;
|
||||
if (currentPage.getEnd() >= mBookUtil.getBookLen()) {
|
||||
Log.d(TAG,"已经是本章最后一页了");
|
||||
|
@ -559,11 +568,11 @@ public class PageFactory {
|
|||
NetUtil.cancelRequest(mBook.getNovelId() );
|
||||
}catch (Exception e)
|
||||
{
|
||||
Log.e(TAG, "prepareBook: error on canceling request "+e.getMessage());
|
||||
Log.e(TAG, "prepare Book: error on canceling request "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "prepareBook: .start prepare book " + book.getName());
|
||||
// Log.d(TAG, "prepareBook: .start prepare book " + book.getName());
|
||||
this.mBook = book ;
|
||||
mBookUtil = new BookUtil();
|
||||
//this.mBookUtil.setContext(context);
|
||||
|
@ -602,7 +611,7 @@ public class PageFactory {
|
|||
}
|
||||
|
||||
bookTask = new BookTask();
|
||||
|
||||
Log.d(TAG, String.format("prepare book 1 to open chapter %s ",book.getLastReadChapt() ) );
|
||||
bookTask.execute((long)book.getLastReadChapt(),book .getLastReadPos());
|
||||
}
|
||||
|
||||
|
@ -617,7 +626,7 @@ public class PageFactory {
|
|||
return;
|
||||
}
|
||||
if (result) {
|
||||
PageFactory.mStatus = PageFactory.Status.FINISH;
|
||||
|
||||
// m_mbBufLen = mBookUtil.getBookLen();
|
||||
mBookUtil.setChapterNo((int)chapter);
|
||||
currentChaptPages = loadCurrentChapt((int)chapter);
|
||||
|
@ -626,6 +635,8 @@ public class PageFactory {
|
|||
if (mBookPageWidget != null) {
|
||||
currentPage(true);
|
||||
}
|
||||
|
||||
PageFactory.mStatus = PageFactory.Status.FINISH;
|
||||
}else{
|
||||
PageFactory.mStatus = PageFactory.Status.FAIL;
|
||||
drawStatus(mBookPageWidget.getCurPage());
|
||||
|
@ -939,6 +950,7 @@ public class PageFactory {
|
|||
}
|
||||
return num;
|
||||
*/
|
||||
|
||||
currentChapter = mBookUtil.getChapterNo();
|
||||
return currentChapter ;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 实心 -->
|
||||
<solid android:color="@color/read_dialog_bg"/>
|
||||
<solid android:color="@color/colorPrimaryDark"/>
|
||||
<!-- 渐变 -->
|
||||
<!--<gradient-->
|
||||
<!--android:startColor="#ff8c00"-->
|
||||
|
@ -11,13 +11,13 @@
|
|||
<!-- 描边 -->
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/read_dialog_button_select" />
|
||||
android:color="@color/white" />
|
||||
<!-- 圆角 -->
|
||||
<corners
|
||||
android:radius="6dp" />
|
||||
<padding
|
||||
android:left="5dp"
|
||||
android:top="10dp"
|
||||
android:right="5dp"
|
||||
android:bottom="10dp" />
|
||||
android:left="15dp"
|
||||
android:top="5dp"
|
||||
android:right="15dp"
|
||||
android:bottom="5dp" />
|
||||
</shape>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 实心 -->
|
||||
<solid android:color="@color/read_dialog_bg"/>
|
||||
<solid android:color="@color/colorPrimary"/>
|
||||
<!-- 渐变 -->
|
||||
<!--<gradient-->
|
||||
<!--android:startColor="#ff8c00"-->
|
||||
|
@ -11,13 +11,15 @@
|
|||
<!-- 描边 -->
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/white" />
|
||||
android:color="@color/colorPrimary" />
|
||||
<!-- 圆角 -->
|
||||
<corners
|
||||
android:radius="6dp" />
|
||||
<padding
|
||||
android:left="5dp"
|
||||
android:top="10dp"
|
||||
android:top="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="10dp" />
|
||||
android:bottom="5dp" />
|
||||
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM19,11L9,11L9,9h10v2zM15,15L9,15v-2h6v2zM19,7L9,7L9,5h10v2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" 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>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z"/>
|
||||
</vector>
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/colorAccent" />
|
||||
<!-- solid android:color="@color/colorAccent" /-->
|
||||
<solid android:color="@color/colorPrimaryDark" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/button_select_bg" android:state_checked="true"></item>
|
||||
<item android:drawable="@drawable/button_bg" android:state_checked="false"></item>
|
||||
|
||||
</selector>
|
|
@ -2,8 +2,18 @@
|
|||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
|
||||
android:endColor="@color/colorPrimaryDark"
|
||||
android:startColor="@color/colorPrimary"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
|
||||
<!--
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:centerColor="#009688"
|
||||
android:endColor="#00695C"
|
||||
android:startColor="#4DB6AC"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
|
||||
-->
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Activity_shudan">
|
||||
|
||||
|
||||
|
||||
<com.czp.searchmlist.mSearchLayout
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/msearchlayout"
|
||||
app:search_hint="小说搜索"
|
||||
app:search_baground="@drawable/search_baground_shap"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -54,24 +54,20 @@
|
|||
/>
|
||||
<RadioGroup
|
||||
android:id="@+id/rgSex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:outlineAmbientShadowColor="@color/colorPrimaryDark"
|
||||
android:outlineSpotShadowColor="@color/lightgray"
|
||||
android:orientation="horizontal"
|
||||
|
||||
style="@style/radioGroup"
|
||||
>
|
||||
<RadioButton
|
||||
android:id="@+id/radioButtonBoy"
|
||||
android:text="男生 "
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="男生"
|
||||
style="@style/radioButton"
|
||||
android:checked="true"
|
||||
/>
|
||||
<RadioButton
|
||||
android:id="@+id/radioButtonGirl"
|
||||
android:text="女生"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
style="@style/radioButton"
|
||||
/>
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/crimson"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="45dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/crimson"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="45dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
/>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/llOutside"
|
||||
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".Activity_Search"
|
||||
tools:showIn="@layout/activity_search">
|
||||
<!-- <com.tangguna.searchbox.library.widget.SearchListLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/msearchlayout"
|
||||
app:search_hint="输入搜索内容"
|
||||
app:search_baground="@drawable/search_baground_shap">
|
||||
</com.tangguna.searchbox.library.widget.SearchListLayout>
|
||||
-->
|
||||
<com.czp.searchmlist.mSearchLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/msearchlayout"
|
||||
app:search_hint="小说搜索"
|
||||
app:search_baground="@drawable/search_baground_shap"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -16,11 +16,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/crimson"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="45dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
|
||||
|
|
|
@ -177,17 +177,18 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="5dp"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0"
|
||||
android:layout_marginRight="5dp"
|
||||
android:src="@drawable/ic_mood_black_24dp" />
|
||||
android:src="@mipmap/directory" />
|
||||
<TextView
|
||||
style="@style/TextViewDesc"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="11sp"
|
||||
android:visibility="gone"
|
||||
android:text="目录" />
|
||||
|
||||
|
||||
|
|
|
@ -11,15 +11,15 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/crimson"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="45dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
|
||||
/>
|
||||
<!-- app:tl_indicator_color="@color/crimson" -->
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<TextView
|
||||
android:id="@+id/tvBlock1"
|
||||
style="@style/NovelBlockTitle"
|
||||
android:text="block"
|
||||
android:text=""
|
||||
/>
|
||||
|
||||
|
||||
|
@ -163,7 +163,7 @@
|
|||
<TextView
|
||||
android:id="@+id/tvBlock2"
|
||||
style="@style/NovelBlockTitle"
|
||||
android:text="block"
|
||||
android:text=""
|
||||
/>
|
||||
|
||||
|
||||
|
@ -221,7 +221,7 @@
|
|||
<TextView
|
||||
android:id="@+id/tvBlock3"
|
||||
style="@style/NovelBlockTitle"
|
||||
android:text="block"
|
||||
android:text=""
|
||||
/>
|
||||
|
||||
|
||||
|
@ -282,7 +282,7 @@
|
|||
<TextView
|
||||
android:id="@+id/tvBlock4"
|
||||
style="@style/NovelBlockTitle"
|
||||
android:text="block"
|
||||
android:text=""
|
||||
/>
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="0dp"
|
||||
app:tl_indicator_width="0dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
app:tl_textsize="13sp"
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
android:paddingTop="4dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/white"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="0dp"
|
||||
app:tl_indicator_width="0dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
app:tl_textsize="13sp"
|
||||
|
|
|
@ -34,6 +34,7 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
|||
android:layout_height="@dimen/botoomNavi"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:paddingTop="2dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
|
|
@ -42,13 +42,13 @@
|
|||
android:layout_height="15dp"
|
||||
android:gravity="center_vertical"
|
||||
|
||||
android:text="完本精选"
|
||||
android:text=""
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNovels"
|
||||
android:text="圣诞老人 奇遇记 风马牛大战 当夏洛克遇到马洛特 圣诞老人 奇遇记 风马牛大战 当夏洛克遇到马洛特"
|
||||
style="@style/TextViewNovelDesc"/>
|
||||
android:text=""
|
||||
style="@style/TextViewNovelDesc.titles"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
android:layout_weight="0"
|
||||
android:padding="2dp"
|
||||
android:id="@+id/imageViewCate"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="100dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/googleg_standard_color_18"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
@ -38,7 +38,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
|
|
|
@ -39,11 +39,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/crimson"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="45dp"
|
||||
app:tl_textSelectColor="@color/crimson"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_tab_space_equal ="true"
|
||||
/>
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
<item
|
||||
android:id="@+id/menuSearch"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/test"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
android:title=""
|
||||
android:icon="@drawable/ic_search_white_24dp"
|
||||
|
||||
app:showAsAction="ifRoom" />
|
||||
<!--item
|
||||
<!--item app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
android:id="@+id/menu_2"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/fenlei"
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/ic_mood_black_24dp"
|
||||
android:icon="@drawable/ic_favorite_border_black_24dp"
|
||||
android:title="@string/title_home" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_dashboard"
|
||||
android:icon="@drawable/ic_toys_black_24dp"
|
||||
android:icon="@drawable/ic_library_books_black_24dp"
|
||||
android:title="@string/title_dashboard" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_notifications"
|
||||
android:icon="@drawable/ic_notifications_black_24dp"
|
||||
android:icon="@drawable/ic_star_border_black_24dp"
|
||||
android:title="@string/title_notifications" />
|
||||
|
||||
</menu>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorPrimary">#FF7F50</color>
|
||||
<color name="colorPrimaryDark">#FF6347</color>
|
||||
<color name="colorPrimary3">#008577</color>
|
||||
<color name="colorPrimaryDark3">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="gray">#000000</color>
|
||||
|
@ -234,4 +236,7 @@
|
|||
<!-- Navigation Color is 30% black mask attack to primary color -->
|
||||
<color name="myNavigationColor">#2E5CAB</color>
|
||||
<color name="myNavigationColorWhite">#B2B2B2</color>
|
||||
|
||||
<color name="tabSelected">#FF6347</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
|
||||
</style>
|
||||
<style name="llGraySplit.2dp.gray">
|
||||
<item name="android:background">@color/lightgray</item>
|
||||
<item name="android:background">@color/whitesmoke</item>
|
||||
|
||||
</style>
|
||||
<style name="TextViewTitle">
|
||||
|
@ -194,9 +194,20 @@
|
|||
<style name="radioGroup">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="radioButton">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:layout_gravity">center_vertical</item>
|
||||
<item name="android:background">@drawable/rb_nobtn_selector</item>
|
||||
<item name="android:button">@null</item>
|
||||
|
||||
|
||||
</style>
|
||||
<style name="TextViewFill">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
|
@ -320,10 +331,13 @@
|
|||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:lines">1</item>
|
||||
<item name="android:lines">2</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
</style>
|
||||
<style name="TextViewNovelDesc.titles">
|
||||
<item name="android:lines">1</item>
|
||||
</style>
|
||||
<style name="TextViewNovelDesc.head">
|
||||
<item name="android:layout_margin">10dp</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
|
@ -389,4 +403,7 @@
|
|||
<item name="android:textSize">14sp</item><!--bookdetail toolbar 展开后字体大小-->
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.astuetz:pagerslidingtabstrip:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.youth.banner:banner:1.4.10@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.chengzipi:Searchbox:v1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.litepal.android:java:3.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils:28.0.0@aar" level="project" />
|
||||
|
|
Loading…
Reference in New Issue