enhance...
This commit is contained in:
parent
d2b450806c
commit
e826ab5329
|
@ -78,6 +78,11 @@
|
|||
android:name=".Activity_cache"
|
||||
android:label="@string/title_download"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".AD.AdvertisementViewActivity"
|
||||
android:label="@string/title_download"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar"></activity>
|
||||
|
||||
<service
|
||||
android:name=".service.ServiceDownload"
|
||||
android:exported="false" />
|
||||
|
|
|
@ -29,7 +29,7 @@ import butterknife.ButterKnife;
|
|||
public class Activity_ChgSource extends Activity_base {
|
||||
|
||||
|
||||
private static final String TAG = Activity_ChgSource.class.getSimpleName();
|
||||
public static final String TAG = Activity_ChgSource.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.recycleView)
|
||||
RecyclerView recyclerView;
|
||||
|
|
|
@ -28,7 +28,7 @@ import butterknife.ButterKnife;
|
|||
|
||||
public class Activity_Search extends Activity_base {
|
||||
|
||||
private static final String TAG=Activity_Search.class.getSimpleName();
|
||||
public static final String TAG=Activity_Search.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.msearchlayout)
|
||||
mSearchLayout searchLayout;
|
||||
|
|
|
@ -22,7 +22,7 @@ import butterknife.BindView;
|
|||
|
||||
|
||||
public class Activity_createShudan extends Activity_base {
|
||||
|
||||
public static final String TAG = Activity_createShudan.class.getSimpleName();
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar ;
|
||||
BookListAdapter mAdapter;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
|||
import butterknife.BindView;
|
||||
|
||||
public class Activity_paihangbang extends Activity_base {
|
||||
public static String TAG ="com.novelbook.android.paihangbang";
|
||||
public static final String TAG = Activity_paihangbang.class.getSimpleName();
|
||||
@BindView(R.id.viewpager)
|
||||
ViewPager mViewpager;
|
||||
@BindView(R.id.tab_layout)
|
||||
|
|
|
@ -81,13 +81,13 @@ import okhttp3.ResponseBody;
|
|||
import static com.novelbook.android.FileActivity.EXTERNAL_STORAGE_REQ_CODE;
|
||||
|
||||
public class BookActivity extends Activity_base {
|
||||
|
||||
public static final String TAG=BookActivity.class.getSimpleName();
|
||||
private PageFactory pageFactory;
|
||||
int novelId = 0;
|
||||
// String muluUrl = "https://www.qu.la/book/390/";
|
||||
private Novel mNovel;
|
||||
private Chapter mChapter;
|
||||
static String TAG = BookActivity.class.getSimpleName();
|
||||
|
||||
BookListAdapter mAdapterAuthor;
|
||||
// private BookListAdapter mAdapter;
|
||||
private List<Novel> mDataAuthor;
|
||||
|
@ -303,17 +303,14 @@ public class BookActivity extends Activity_base {
|
|||
btnShelf.setText(title);
|
||||
}
|
||||
|
||||
@OnClick({R.id.btnRead, R.id.btnCacheBook, R.id.btnShelf,R.id.llCate,R.id.btnFistPage})
|
||||
@OnClick({R.id.btnRead, R.id.btnCacheBook, R.id.btnShelf,R.id.llCate})
|
||||
void submitButton(View view) {
|
||||
Intent intent;
|
||||
if(mNovel==null){
|
||||
return;
|
||||
}
|
||||
switch (view.getId()) {
|
||||
case R.id.btnFistPage:
|
||||
intent = new Intent(BookActivity.this, Main2Activity.class);
|
||||
startActivity(intent);;
|
||||
break;
|
||||
|
||||
case R.id.btnRead:
|
||||
readBook();
|
||||
//testBook();
|
||||
|
|
|
@ -29,7 +29,7 @@ import butterknife.BindView;
|
|||
|
||||
|
||||
public class FileActivity extends Activity_base {
|
||||
|
||||
public static final String TAG=FileActivity.class.getSimpleName();
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.btn_choose_all)
|
||||
|
|
|
@ -28,7 +28,8 @@ import butterknife.BindView;
|
|||
* Created by Administrator on 2016/8/31 0031.
|
||||
*/
|
||||
public class BookMarkFragment extends BasicFragment implements MarkActivity.Sortmark{
|
||||
public static String TAG=BookMarkFragment.class.getSimpleName();
|
||||
public static final String TAG=BookMarkFragment.class.getSimpleName();
|
||||
|
||||
public static final String ARGUMENT = "argument";
|
||||
|
||||
@BindView(R.id.lv_bookmark)
|
||||
|
@ -60,7 +61,10 @@ public class BookMarkFragment extends BasicFragment implements MarkActivity.Sor
|
|||
domain = nv.getDomain();
|
||||
}
|
||||
}
|
||||
bookMarksList = LitePal.where("novelId = ? and domain= ?", novelId+"",domain).order(String.format("id %s",isAsc ?"asc" :"desc")). find(BookMarks.class);
|
||||
if(null!=domain || !TextUtils.isEmpty(domain)){
|
||||
bookMarksList = LitePal.where("novelId = ? and domain= ?", novelId+"",domain).order(String.format("id %s",isAsc ?"asc" :"desc")). find(BookMarks.class);
|
||||
}
|
||||
|
||||
Log.d(TAG, "initData: bookmark size " +bookMarksList.size());
|
||||
markAdapter = new MarkAdapter(getActivity(), bookMarksList);
|
||||
lv_bookmark.setAdapter(markAdapter);
|
||||
|
|
|
@ -104,6 +104,7 @@ public class CatalogFragment extends BasicFragment implements MarkActivity.Sortc
|
|||
void refresh(View view) {
|
||||
pageFactory.refreshCate();
|
||||
loadData();
|
||||
btnRefresh.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ArrayList<Chapter> revertArray(){
|
||||
|
@ -142,7 +143,7 @@ public class CatalogFragment extends BasicFragment implements MarkActivity.Sortc
|
|||
}
|
||||
|
||||
public void loadData(){
|
||||
showProgressDialog(false,"请稍等");
|
||||
showProgressDialog(false,"正在读取目录数据,请稍等");
|
||||
|
||||
catalogueList.clear();
|
||||
catalogueAdapter = new CatalogueAdapter(getContext(), catalogueList);
|
||||
|
@ -190,13 +191,13 @@ public class CatalogFragment extends BasicFragment implements MarkActivity.Sortc
|
|||
}
|
||||
}
|
||||
Log.d(TAG, String .format("prepare book:to open book cate slept %s" , slepttime*50));
|
||||
if ( !pageFactory.isReadingCatalogs() && pageFactory.getChapters().size() == 0) {
|
||||
/* if ( !pageFactory.isReadingCatalogs() && pageFactory.getChapters().size() == 0) {
|
||||
|
||||
handler.sendEmptyMessage(2);
|
||||
}else{
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
|
||||
}*/
|
||||
handler.sendEmptyMessage(1);
|
||||
|
||||
}
|
||||
}.start();
|
||||
|
|
|
@ -62,11 +62,7 @@ import okhttp3.ResponseBody;
|
|||
|
||||
|
||||
public class Fragment_Shelf extends BasicFragment {
|
||||
public static String TAG=Fragment_Shelf.class.getSimpleName();
|
||||
public static String getFTag() {
|
||||
return "com.novelbook.android.Fragments.Fragment_Shelf";
|
||||
}
|
||||
|
||||
public static final String TAG=Fragment_Shelf.class.getSimpleName();
|
||||
private boolean[] flag ;//此处添加一个boolean类型的数组
|
||||
private boolean isSelectAll =true;
|
||||
private MyImageLoader loader = new MyImageLoader();
|
||||
|
@ -496,10 +492,6 @@ void test(int maxAge){
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setFTag() {
|
||||
TAG="com.novelbook.android.Fragments.Fragment_Shelf";
|
||||
}
|
||||
|
||||
CheckAdapter mChkAdapter;
|
||||
void zhengliShelf(){
|
||||
|
|
|
@ -25,7 +25,7 @@ import q.rorbin.verticaltablayout.VerticalTabLayout;
|
|||
|
||||
public class Fragment_bangdans extends BasicFragment {
|
||||
|
||||
public static String TAG= Fragment_bangdans.class.getSimpleName();
|
||||
public static final String TAG= Fragment_bangdans.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.viewpager)
|
||||
ViewPager mViewpager;
|
||||
|
|
|
@ -18,7 +18,7 @@ import butterknife.BindView;
|
|||
|
||||
public class Fragment_bookStore extends BasicFragment {
|
||||
|
||||
public static String TAG=Fragment_bookStore.class.getSimpleName();
|
||||
public final static String TAG=Fragment_bookStore.class.getSimpleName();
|
||||
public static String getFTag() {
|
||||
return "com.novelbook.android.Fragments.Fragment_bookStore";
|
||||
}
|
||||
|
@ -139,10 +139,6 @@ public class Fragment_bookStore extends BasicFragment {
|
|||
|
||||
|
||||
|
||||
@Override
|
||||
public void setFTag() {
|
||||
TAG="com.novelbook.android.Fragment_Store";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import butterknife.BindView;
|
|||
|
||||
|
||||
public class Fragment_booklist extends BasicFragment {
|
||||
public static String TAG = Fragment_booklist.class.getSimpleName();
|
||||
public static final String TAG = Fragment_booklist.class.getSimpleName();
|
||||
private static final String EXTR_CATE ="cate" ;
|
||||
private static final String EXTR_PROGRESS ="progress" ;
|
||||
private static final String EXTR_SEARCH ="search";
|
||||
|
|
|
@ -61,7 +61,7 @@ import butterknife.OnClick;
|
|||
|
||||
|
||||
public class Fragment_jingxuan extends BasicFragment implements OnBannerListener {
|
||||
public static String TAG=Fragment_jingxuan.class.getSimpleName();
|
||||
public static final String TAG=Fragment_jingxuan.class.getSimpleName();
|
||||
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
@ -282,10 +282,6 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
|
||||
|
||||
|
||||
@Override
|
||||
public void setFTag() {
|
||||
TAG = "com.novelbook.android.Fragments.Fragment_jingxuan";
|
||||
}
|
||||
|
||||
@OnClick({R.id.buttonMore1, R.id.buttonMore2, R.id.buttonMoreTuijian, R.id.buttonMore3
|
||||
, R.id.buttonCatePingfen, R.id.buttonCateRegeng, R.id.buttonCateTuijian, R.id.buttonCateShoucang, R.id.buttonCateWanjie
|
||||
|
|
|
@ -18,7 +18,7 @@ import butterknife.ButterKnife;
|
|||
import butterknife.OnClick;
|
||||
|
||||
public class Fragment_jingxuan_tuijian extends BasicFragment {
|
||||
final public static String TAG =Fragment_jingxuan.class.getSimpleName();
|
||||
public static final String TAG =Fragment_jingxuan.class.getSimpleName();
|
||||
@BindView(R.id.imageGallary1)
|
||||
ImageView imageView1;
|
||||
@BindView(R.id.imageGallary2)
|
||||
|
|
|
@ -44,11 +44,8 @@ import static com.novelbook.android.utils.Constants.lstProgress;
|
|||
import static com.novelbook.android.utils.Constants.lstSex;
|
||||
|
||||
public class Fragment_paihang extends BasicFragment {
|
||||
final String TAG = Fragment_paihang.class.getSimpleName();
|
||||
public static final String TAG = Fragment_paihang.class.getSimpleName();
|
||||
|
||||
public static String getFTag() {
|
||||
return "com.novelbook.android.Fragments.Fragment_paihang";
|
||||
}
|
||||
|
||||
private ArrayList<CustomTabEntity> mData1,mData2,mData3 ;
|
||||
private int tab1Pos,tab2Pos,tab3Pos;
|
||||
|
@ -210,7 +207,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
}
|
||||
};
|
||||
showProgressDialog(false, "正在加载...");
|
||||
BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, Constants.lstProgressType.get(tab3Pos).getId(), new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
BookSubscribe.getCateNovelList(cate, pageNo, tab1Pos+1, Constants.lstProgressType.get(tab3Pos).getId(), new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
|
||||
|
||||
}
|
||||
|
@ -249,7 +246,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
|
||||
|
||||
private void initTabs() {
|
||||
|
||||
tmp=0;
|
||||
/*
|
||||
while(lstNt==null){
|
||||
try {
|
||||
|
@ -409,7 +406,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
super.onResume();
|
||||
//mNestedScrollView.smoothScrollBy(1,1);
|
||||
// tvHint.setVisibility(isShowHint? View.VISIBLE:View.GONE);
|
||||
tmp=0;
|
||||
// tmp=0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import butterknife.BindView;
|
|||
|
||||
|
||||
public class Fragment_shudan extends BasicFragment {
|
||||
public static String TAG=Fragment_shudan.class.getSimpleName();
|
||||
public static final String TAG=Fragment_shudan.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.fab)
|
||||
FloatingActionButton fab;
|
||||
|
@ -73,10 +73,6 @@ public class Fragment_shudan extends BasicFragment {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFTag() {
|
||||
TAG ="com.novelbook.android.Fragments.Fragment_shudan";
|
||||
}
|
||||
|
||||
//---------tabs-------------
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
import butterknife.BindView;
|
||||
|
||||
public class Fragment_shudan_list extends BasicFragment {
|
||||
public static String TAG=Fragment_shudan_list.class.getSimpleName();
|
||||
public static final String TAG=Fragment_shudan_list.class.getSimpleName();
|
||||
|
||||
private char cnt;
|
||||
ShudanAdapter mAdapter;
|
||||
|
|
|
@ -50,7 +50,7 @@ import butterknife.OnClick;
|
|||
public class Main2Activity extends Activity_base
|
||||
implements NavigationView.OnNavigationItemSelectedListener{//} , BasicFragment.OnFragmentInteractionListener {
|
||||
public MyApp app ;
|
||||
public static String TAG ="com.novelbook.android.Main2Activity";
|
||||
public static final String TAG =Main2Activity.class.getSimpleName();
|
||||
|
||||
// @BindView(R.id.fab)
|
||||
// FloatingActionButton fab ;
|
||||
|
@ -396,18 +396,18 @@ private int bottomSelectedIndex;
|
|||
private void showHome() {
|
||||
|
||||
Fragment_Shelf fragment_Shelf = (Fragment_Shelf) getSupportFragmentManager()
|
||||
.findFragmentByTag(Fragment_Shelf.getFTag());
|
||||
.findFragmentByTag(Fragment_Shelf.TAG );
|
||||
if(fragment_Shelf==null) fragment_Shelf =new Fragment_Shelf();
|
||||
showFragment(fragment_Shelf,Fragment_Shelf.getFTag());
|
||||
showFragment(fragment_Shelf,Fragment_Shelf.TAG);
|
||||
swithToolbarItems();
|
||||
|
||||
|
||||
}
|
||||
private void showBookStore() {
|
||||
Fragment_bookStore fragment = (Fragment_bookStore) getSupportFragmentManager()
|
||||
.findFragmentByTag(Fragment_bookStore.getFTag());
|
||||
.findFragmentByTag(Fragment_bookStore.TAG);
|
||||
if(fragment ==null) fragment =new Fragment_bookStore();
|
||||
showFragment(fragment , Fragment_bookStore.getFTag());
|
||||
showFragment(fragment , Fragment_bookStore.TAG);
|
||||
swithToolbarItems();
|
||||
|
||||
|
||||
|
@ -420,9 +420,9 @@ private int bottomSelectedIndex;
|
|||
private void showPaihang(){
|
||||
|
||||
Fragment_paihang fragment = (Fragment_paihang) getSupportFragmentManager()
|
||||
.findFragmentByTag(Fragment_paihang.getFTag());
|
||||
.findFragmentByTag(Fragment_paihang.TAG);
|
||||
if(fragment ==null) fragment =new Fragment_paihang();
|
||||
showFragment(fragment ,Fragment_paihang.getFTag());
|
||||
showFragment(fragment ,Fragment_paihang.TAG);
|
||||
swithToolbarItems( );
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.novelbook.android.netutils.NetUtil;
|
|||
import com.novelbook.android.utils.Config;
|
||||
import com.novelbook.android.utils.LogcatHelper;
|
||||
import com.novelbook.android.utils.PageFactory;
|
||||
import com.novelbook.android.AD.SplashAdManager;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.umeng.commonsdk.UMConfigure;
|
||||
|
||||
|
@ -15,6 +16,7 @@ import org.litepal.LitePal;
|
|||
|
||||
public class MyApp extends Application {
|
||||
public static volatile Context applicationContext = null;
|
||||
SplashAdManager splashAdManager;
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
@ -25,9 +27,9 @@ public class MyApp extends Application {
|
|||
Config.createConfig(this);
|
||||
PageFactory.createPageFactory(this);
|
||||
LogcatHelper.getInstance(this).start();
|
||||
|
||||
// BlurKit.init(this);
|
||||
LitePal.initialize(this);
|
||||
splashAdManager = new SplashAdManager(this);
|
||||
initApi();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,22 +26,19 @@ import android.view.animation.Animation;
|
|||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.baidu.tts.client.SpeechError;
|
||||
import com.baidu.tts.client.SpeechSynthesizer;
|
||||
import com.baidu.tts.client.SpeechSynthesizerListener;
|
||||
import com.novelbook.android.db.Chapter;
|
||||
import com.novelbook.android.db.Novel;
|
||||
import com.novelbook.android.db.BookMarks;
|
||||
import com.novelbook.android.dialog.PageModeDialog;
|
||||
import com.novelbook.android.dialog.SettingDialog;
|
||||
import com.novelbook.android.netutils.NetUtil;
|
||||
|
||||
import com.novelbook.android.utils.AdInterface;
|
||||
import com.novelbook.android.utils.BrightnessUtil;
|
||||
import com.novelbook.android.utils.Config;
|
||||
|
@ -52,7 +49,6 @@ import com.umeng.analytics.MobclickAgent;
|
|||
|
||||
import org.litepal.LitePal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -65,8 +61,8 @@ import butterknife.BindView;
|
|||
import butterknife.OnClick;
|
||||
|
||||
|
||||
public class ReadActivity extends Activity_base implements SpeechSynthesizerListener , AdInterface {
|
||||
private static final String TAG = "ReadActivity";
|
||||
public class ReadActivity extends Activity_base implements AdInterface {
|
||||
private static final String TAG = ReadActivity.class.getSimpleName();
|
||||
private final static String EXTRA_BOOK = "book";
|
||||
private final static String EXTRA_CHAPTER = "chapter";
|
||||
private final static int MESSAGE_CHANGEPROGRESS = 1;
|
||||
|
@ -630,6 +626,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
}
|
||||
}
|
||||
}
|
||||
hideReadSetting();
|
||||
}
|
||||
/* else if (id == R.id.action_read_book){
|
||||
initialTts();
|
||||
|
@ -665,6 +662,8 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
// }
|
||||
}else if(id == R.id.action_refresh){
|
||||
pageFactory.refreshChapter();
|
||||
hideReadSetting();
|
||||
|
||||
}else if(id == R.id.action_bookdetail){
|
||||
showBookDetail(this.book);
|
||||
//finish();
|
||||
|
@ -854,52 +853,6 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
hideSystemUI();
|
||||
}
|
||||
|
||||
private void initialTts() {
|
||||
|
||||
/* this.mSpeechSynthesizer = SpeechSynthesizer.getInstance();
|
||||
this.mSpeechSynthesizer.setContext(this);
|
||||
this.mSpeechSynthesizer.setSpeechSynthesizerListener(this);
|
||||
// 文本模型文件路径 (离线引擎使用)
|
||||
this.mSpeechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_TEXT_MODEL_FILE, ((MyApp)getApplication()).getTTPath() + "/"
|
||||
+ MyApp.TEXT_MODEL_NAME);
|
||||
// 声学模型文件路径 (离线引擎使用)
|
||||
this.mSpeechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_SPEECH_MODEL_FILE, ((MyApp)getApplication()).getTTPath() + "/"
|
||||
+ MyApp.SPEECH_FEMALE_MODEL_NAME);
|
||||
// 本地授权文件路径,如未设置将使用默认路径.设置临时授权文件路径,LICENCE_FILE_NAME请替换成临时授权文件的实际路径,仅在使用临时license文件时需要进行设置,如果在[应用管理]中开通了正式离线授权,不需要设置该参数,建议将该行代码删除(离线引擎)
|
||||
// 如果合成结果出现临时授权文件将要到期的提示,说明使用了临时授权文件,请删除临时授权即可。
|
||||
// this.mSpeechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_LICENCE_FILE, ((AppContext)getApplication()).getTTPath() + "/"
|
||||
// + AppContext.LICENSE_FILE_NAME);
|
||||
// 请替换为语音开发者平台上注册应用得到的App ID (离线授权)
|
||||
this.mSpeechSynthesizer.setAppId("8921835"*//*这里只是为了让Demo运行使用的APPID,请替换成自己的id。*//*);
|
||||
// 请替换为语音开发者平台注册应用得到的apikey和secretkey (在线授权)
|
||||
this.mSpeechSynthesizer.setApiKey("sjEFlROl4j090FtDTHlEpvFB",
|
||||
"a2d95dc24960e03ef2d41a5fb1a2c025"*//*这里只是为了让Demo正常运行使用APIKey,请替换成自己的APIKey*//*);
|
||||
// 发音人(在线引擎),可用参数为0,1,2,3。。。(服务器端会动态增加,各值含义参考文档,以文档说明为准。0--普通女声,1--普通男声,2--特别男声,3--情感男声。。。)
|
||||
this.mSpeechSynthesizer.setParam(SpeechSynthesizer.PARAM_SPEAKER, "0");
|
||||
// 设置Mix模式的合成策略
|
||||
this.mSpeechSynthesizer.setParam(SpeechSynthesizer.PARAM_MIX_MODE, SpeechSynthesizer.MIX_MODE_DEFAULT);
|
||||
// 授权检测接口(只是通过AuthInfo进行检验授权是否成功。)
|
||||
// AuthInfo接口用于测试开发者是否成功申请了在线或者离线授权,如果测试授权成功了,可以删除AuthInfo部分的代码(该接口首次验证时比较耗时),不会影响正常使用(合成使用时SDK内部会自动验证授权)
|
||||
AuthInfo authInfo = this.mSpeechSynthesizer.auth(TtsMode.MIX);
|
||||
|
||||
if (authInfo.isSuccess()) {
|
||||
Log.e(TAG,"auth success");
|
||||
} else {
|
||||
String errorMsg = authInfo.getTtsError().getDetailMessage();
|
||||
Log.e(TAG,"auth failed errorMsg=" + errorMsg);
|
||||
}
|
||||
|
||||
// 初始化tts
|
||||
mSpeechSynthesizer.initTts(TtsMode.MIX);
|
||||
// 加载离线英文资源(提供离线英文合成功能)
|
||||
int result = mSpeechSynthesizer.loadEnglishModel(((MyApp)getApplication()).getTTPath() + "/" + MyApp.ENGLISH_TEXT_MODEL_NAME, ((MyApp)getApplication()).getTTPath()
|
||||
+ "/" + MyApp.ENGLISH_SPEECH_FEMALE_MODEL_NAME);
|
||||
// toPrint("loadEnglishModel result=" + result);
|
||||
//
|
||||
// //打印引擎信息和model基本信息
|
||||
// printEngineInfo();
|
||||
*/
|
||||
}
|
||||
|
||||
@OnClick({R.id.tv_progress, R.id.rl_progress, R.id.tv_pre, R.id.sb_progress, R.id.tv_next, R.id.tv_directory,
|
||||
R.id.tv_dayornight,R.id.tv_pagemode, R.id.tv_setting, R.id.bookpop_bottom, /*R.id.rl_bottom,*/R.id.tv_stop_read
|
||||
|
@ -928,6 +881,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
case R.id.tv_directory:
|
||||
Intent intent = new Intent(ReadActivity.this, MarkActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
break;
|
||||
case R.id.tv_dayornight:
|
||||
changeDayOrNight();
|
||||
|
@ -984,86 +938,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* @param arg0
|
||||
*/
|
||||
@Override
|
||||
public void onSynthesizeStart(String s) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 合成数据和进度的回调接口,分多次回调
|
||||
*
|
||||
* @param utteranceId
|
||||
* @param data 合成的音频数据。该音频数据是采样率为16K,2字节精度,单声道的pcm数据。
|
||||
* @param progress 文本按字符划分的进度,比如:你好啊 进度是0-3
|
||||
*/
|
||||
@Override
|
||||
public void onSynthesizeDataArrived(String utteranceId, byte[] data, int progress) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 合成正常结束,每句合成正常结束都会回调,如果过程中出错,则回调onError,不再回调此接口
|
||||
*
|
||||
* @param utteranceId
|
||||
*/
|
||||
@Override
|
||||
public void onSynthesizeFinish(String utteranceId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放开始,每句播放开始都会回调
|
||||
*
|
||||
* @param utteranceId
|
||||
*/
|
||||
@Override
|
||||
public void onSpeechStart(String utteranceId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放进度回调接口,分多次回调
|
||||
*
|
||||
* @param utteranceId
|
||||
* @param progress 文本按字符划分的进度,比如:你好啊 进度是0-3
|
||||
*/
|
||||
@Override
|
||||
public void onSpeechProgressChanged(String utteranceId, int progress) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放正常结束,每句播放正常结束都会回调,如果过程中出错,则回调onError,不再回调此接口
|
||||
*
|
||||
* @param utteranceId
|
||||
*/
|
||||
@Override
|
||||
public void onSpeechFinish(String utteranceId) {
|
||||
/* pageFactory.nextPage();
|
||||
if (pageFactory.islastPage()) {
|
||||
isSpeaking = false;
|
||||
Toast.makeText(ReadActivity.this,"小说已经读完了",Toast.LENGTH_SHORT);
|
||||
}else {
|
||||
isSpeaking = true;
|
||||
mSpeechSynthesizer.speak(pageFactory.getCurrentPage().getLineToString());
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 当合成或者播放过程中出错时回调此接口
|
||||
*
|
||||
* @param utteranceId
|
||||
* @param error 包含错误码和错误信息
|
||||
*/
|
||||
@Override
|
||||
public void onError(String utteranceId, SpeechError error) {
|
||||
/* mSpeechSynthesizer.stop();
|
||||
isSpeaking = false;
|
||||
Log.e(TAG,error.description);*/
|
||||
}
|
||||
|
||||
final int contentAdHight=350;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
|
||||
public class activity_cates extends Activity_base {
|
||||
private String TAG = activity_cates.class.getSimpleName();
|
||||
public final static String TAG = activity_cates.class.getSimpleName();
|
||||
@BindView(R.id.recycleViewCateList)
|
||||
RecyclerView mRecyclerView;
|
||||
private BookListAdapter mAdapter;
|
||||
|
|
|
@ -184,6 +184,7 @@ public class PageFactory implements ChangeSource{
|
|||
private BookTask bookTask;
|
||||
private int MSG_NEXTPAGE=2;
|
||||
private int MSG_HIDEPROGRESS=3;
|
||||
private int MSG_NEXTPAGE_FAIL=4;
|
||||
public AdInterface getmAd() {
|
||||
return mAd;
|
||||
}
|
||||
|
@ -221,6 +222,11 @@ public class PageFactory implements ChangeSource{
|
|||
// drawStatus();
|
||||
Log.d(TAG, "prepare book to load next page");
|
||||
nextPage();
|
||||
} else if (msg.what == MSG_NEXTPAGE_FAIL) {
|
||||
|
||||
mStatus =Status.FAIL;
|
||||
drawStatus();
|
||||
|
||||
} else if (msg.what == MSG_HIDEPROGRESS) {
|
||||
dismissProgressDialog();
|
||||
if(mAd!=null) {
|
||||
|
@ -506,15 +512,28 @@ public class PageFactory implements ChangeSource{
|
|||
return mBookUtil.getChapter(mBookUtil.getChapterNo());
|
||||
}
|
||||
|
||||
private static boolean isBusy =false;
|
||||
private static boolean isBusy =false;
|
||||
public void setBusy(boolean isBusy) {
|
||||
this.isBusy = isBusy;
|
||||
}
|
||||
public static boolean busy(){
|
||||
public static boolean busy(){
|
||||
return isBusy;
|
||||
}
|
||||
|
||||
public static boolean canTouch(){
|
||||
switch (mStatus){
|
||||
case FAIL:
|
||||
return true;
|
||||
case FINISH:return true;
|
||||
case OPENING:return false;
|
||||
case SERVERERROR:return true;
|
||||
case CHANGESOURCE:return false;
|
||||
case NETWORKFAILE:return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void refreshChapter() {
|
||||
|
||||
fileRetryCnt.clear();
|
||||
mBookUtil.fileRetryCnt.clear();
|
||||
if( chaptMap.containsKey(getCurrentChapter())){
|
||||
|
@ -522,6 +541,7 @@ public static boolean busy(){
|
|||
}
|
||||
|
||||
mBookUtil.refreshChapter();
|
||||
|
||||
}
|
||||
|
||||
public void changeSourceForCate(String name, String domain) {
|
||||
|
@ -994,15 +1014,17 @@ private void hideSysUI(){
|
|||
|
||||
if (currentPage.getEnd() >= mBookUtil.getChapterLen()) {
|
||||
Log.d(TAG,"已经是本章最后一页了");
|
||||
File file =new File( mBookUtil.fileChapterName(currentChapter+1));
|
||||
if(!file.exists())
|
||||
if(mBookUtil.getChapters().size()==0 &&NetUtil.isNetworkConnected()){
|
||||
|
||||
mBookUtil.setChapterNo(currentChapter+1);
|
||||
mStatus = Status.OPENING;
|
||||
drawStatus();
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
int slepttime = 0;
|
||||
while (mBookUtil.getChapters().size()==0 && (mBookUtil.mMuluStatus == BookUtil.MuluStatus.isDownloading || mBookUtil.muluRetryCount < Constants.retryCnt)) {
|
||||
int slepttime = 0; mBookUtil.muluRetryCount=0;
|
||||
while (slepttime<50 && mBookUtil.getChapters().size()==0 && (mBookUtil.mMuluStatus == BookUtil.MuluStatus.isDownloading || mBookUtil.muluRetryCount < Constants.retryCnt)) {
|
||||
try {
|
||||
sleep(50);
|
||||
slepttime++;
|
||||
|
@ -1016,6 +1038,8 @@ private void hideSysUI(){
|
|||
|
||||
if(mBookUtil.getChapters().size()>0){
|
||||
handler.sendEmptyMessage(MSG_NEXTPAGE) ;
|
||||
}else{
|
||||
handler.sendEmptyMessage(MSG_NEXTPAGE_FAIL) ;
|
||||
}
|
||||
|
||||
}}.start();
|
||||
|
@ -1192,7 +1216,10 @@ private void hideSysUI(){
|
|||
int nextPageNo =currentPage.getPageNo();
|
||||
Log.e(TAG,String.format("prepare book getNextPage() currentChapter %s, chapters().size() %s,currentChaptPages .size() is %s,currentpage pageno is %s"
|
||||
,currentChapter, getChapters().size(), currentChaptPages.size() , nextPageNo));
|
||||
if(nextPageNo >= currentChaptPages.size() && getChapters().size()>currentChapter){
|
||||
if(nextPageNo==0){
|
||||
drawStatus();
|
||||
}
|
||||
if(nextPageNo >= currentChaptPages.size() && (getChapters().size()==0 || getChapters().size()>currentChapter)){
|
||||
preChaptPages =currentChaptPages;
|
||||
currentChapter++;
|
||||
mBookUtil.setChapterNo(currentChapter);
|
||||
|
@ -1206,7 +1233,7 @@ private void hideSysUI(){
|
|||
if(currentChaptPages.size()>nextPageNo)
|
||||
return currentChaptPages.get(nextPageNo);
|
||||
else{
|
||||
return new TRPage("没有了");
|
||||
return new TRPage("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,9 +129,12 @@ public class PageWidget extends View {
|
|||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
super.onTouchEvent(event);
|
||||
if ( PageFactory.getStatus() != PageFactory.Status.FINISH){
|
||||
if(!PageFactory.canTouch()){
|
||||
return true;
|
||||
}
|
||||
/* if ( PageFactory.getStatus() != PageFactory.Status.FINISH){
|
||||
return true;
|
||||
}*/
|
||||
|
||||
int x = (int)event.getX();
|
||||
int y = (int)event.getY();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<item
|
||||
android:id="@+id/nav_fenxiang"
|
||||
android:icon="@drawable/ic_menu_share"
|
||||
|
||||
android:visible="false"
|
||||
android:title="分享应用" />
|
||||
<item
|
||||
android:id="@+id/nav_advice"
|
||||
|
@ -34,7 +34,7 @@
|
|||
<item
|
||||
android:id="@+id/nav_setup"
|
||||
android:icon="@drawable/ic_settings_black_24dp"
|
||||
|
||||
android:visible="false"
|
||||
android:title="设置" />
|
||||
</group>
|
||||
|
||||
|
|
Loading…
Reference in New Issue