mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 01:20:34 +00:00
fix error report and add setting for current_service
This commit is contained in:
parent
f6c624b59a
commit
5ebde97352
@ -8,6 +8,7 @@ import android.support.v4.app.FragmentManager;
|
|||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -20,14 +21,15 @@ import org.schabi.newpipe.BaseFragment;
|
|||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.fragments.list.kiosk.KioskFragment;
|
import org.schabi.newpipe.fragments.list.kiosk.KioskFragment;
|
||||||
import org.schabi.newpipe.fragments.subscription.SubscriptionFragment;
|
import org.schabi.newpipe.fragments.subscription.SubscriptionFragment;
|
||||||
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
|
|
||||||
public class MainFragment extends BaseFragment implements TabLayout.OnTabSelectedListener {
|
public class MainFragment extends BaseFragment implements TabLayout.OnTabSelectedListener {
|
||||||
private ViewPager viewPager;
|
private ViewPager viewPager;
|
||||||
private boolean showBlankTab = false;
|
private boolean showBlankTab = false;
|
||||||
|
|
||||||
//todo: FIX THIS URGENTLY
|
public int currentServiceId = -1;
|
||||||
public int currentServiceId = 0; //for youtube
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Fragment's LifeCycle
|
// Fragment's LifeCycle
|
||||||
@ -41,6 +43,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
currentServiceId = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(getActivity())
|
||||||
|
.getString(getString(R.string.current_service_key), "0"));
|
||||||
return inflater.inflate(R.layout.fragment_main, container, false);
|
return inflater.inflate(R.layout.fragment_main, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +130,11 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||||||
try {
|
try {
|
||||||
return KioskFragment.getInstance(currentServiceId);
|
return KioskFragment.getInstance(currentServiceId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//todo: replace this with propper error reporting
|
ErrorActivity.reportError(activity, e,
|
||||||
e.printStackTrace();
|
activity.getClass(),
|
||||||
|
null,
|
||||||
|
ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,
|
||||||
|
"none", "", R.string.app_ui_crash));
|
||||||
return new BlankFragment();
|
return new BlankFragment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources translatable="false">
|
<resources translatable="false">
|
||||||
|
<!-- Service -->
|
||||||
|
<string name="current_service_key" translatable="false">current_service</string>
|
||||||
|
|
||||||
<!-- Key values -->
|
<!-- Key values -->
|
||||||
<string name="download_path_key" translatable="false">download_path</string>
|
<string name="download_path_key" translatable="false">download_path</string>
|
||||||
<string name="download_path_audio_key" translatable="false">download_path_audio</string>
|
<string name="download_path_audio_key" translatable="false">download_path_audio</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user