Merge remote-tracking branch 'newpipe/dev' into rebase
This commit is contained in:
commit
6f6d33153b
251 changed files with 7588 additions and 2315 deletions
|
|
@ -23,7 +23,7 @@ package org.schabi.newpipe.settings;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ import com.nostra13.universalimageloader.core.ImageLoader;
|
|||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.database.subscription.SubscriptionEntity;
|
||||
import org.schabi.newpipe.local.subscription.SubscriptionManager;
|
||||
import org.schabi.newpipe.report.ErrorActivity;
|
||||
import org.schabi.newpipe.report.UserAction;
|
||||
import org.schabi.newpipe.local.subscription.SubscriptionService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
|
@ -99,8 +99,8 @@ public class SelectChannelFragment extends DialogFragment {
|
|||
emptyView.setVisibility(View.GONE);
|
||||
|
||||
|
||||
SubscriptionService subscriptionService = SubscriptionService.getInstance(getContext());
|
||||
subscriptionService.getSubscription().toObservable()
|
||||
SubscriptionManager subscriptionManager = new SubscriptionManager(getContext());
|
||||
subscriptionManager.subscriptions().toObservable()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscriptionObserver());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package org.schabi.newpipe.settings.custom
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.preference.ListPreference
|
||||
import org.schabi.newpipe.util.Localization
|
||||
|
||||
/**
|
||||
* An extension of a common ListPreference where it sets the duration values to human readable strings.
|
||||
*
|
||||
* The values in the entry values array will be interpreted as seconds. If the value of a specific position
|
||||
* is less than or equals to zero, its original entry title will be used.
|
||||
*
|
||||
* If the entry values array have anything other than numbers in it, an exception will be raised.
|
||||
*/
|
||||
class DurationListPreference : ListPreference {
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context?) : super(context)
|
||||
|
||||
override fun onAttached() {
|
||||
super.onAttached()
|
||||
|
||||
val originalEntryTitles = entries
|
||||
val originalEntryValues = entryValues
|
||||
val newEntryTitles = arrayOfNulls<CharSequence>(originalEntryValues.size)
|
||||
|
||||
for (i in originalEntryValues.indices) {
|
||||
val currentDurationValue: Int
|
||||
try {
|
||||
currentDurationValue = (originalEntryValues[i] as String).toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
throw RuntimeException("Invalid number was set in the preference entry values array", e)
|
||||
}
|
||||
|
||||
if (currentDurationValue <= 0) {
|
||||
newEntryTitles[i] = originalEntryTitles[i]
|
||||
} else {
|
||||
newEntryTitles[i] = Localization.localizeDuration(context, currentDurationValue)
|
||||
}
|
||||
}
|
||||
|
||||
entries = newEntryTitles
|
||||
}
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ public abstract class Tab {
|
|||
|
||||
@Override
|
||||
public String getTabName(Context context) {
|
||||
return context.getString(R.string.fragment_whats_new);
|
||||
return context.getString(R.string.fragment_feed_title);
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue