mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Import platform redirect and disabled buttons, minor ui fixes
This commit is contained in:
parent
e50d195b85
commit
0e7482321c
6 changed files with 51 additions and 5 deletions
|
@ -7,6 +7,7 @@ import android.view.LayoutInflater
|
|||
import android.widget.Button
|
||||
import com.futo.platformplayer.R
|
||||
import com.futo.platformplayer.activities.MainActivity
|
||||
import com.futo.platformplayer.fragment.mainactivity.main.SourcesFragment
|
||||
import com.futo.platformplayer.readBytes
|
||||
import com.futo.platformplayer.states.StateApp
|
||||
import com.futo.platformplayer.states.StateBackup
|
||||
|
@ -19,6 +20,7 @@ class ImportOptionsDialog: AlertDialog {
|
|||
private lateinit var _button_import_ezip: BigButton;
|
||||
private lateinit var _button_import_txt: BigButton;
|
||||
private lateinit var _button_import_newpipe_subs: BigButton;
|
||||
private lateinit var _button_import_platform: BigButton;
|
||||
private lateinit var _button_close: Button;
|
||||
|
||||
|
||||
|
@ -33,6 +35,7 @@ class ImportOptionsDialog: AlertDialog {
|
|||
_button_import_ezip = findViewById(R.id.button_import_ezip);
|
||||
_button_import_txt = findViewById(R.id.button_import_txt);
|
||||
_button_import_newpipe_subs = findViewById(R.id.button_import_newpipe_subs);
|
||||
_button_import_platform = findViewById(R.id.button_import_platform);
|
||||
_button_close = findViewById(R.id.button_cancel);
|
||||
|
||||
_button_import_zip.onClick.subscribe {
|
||||
|
@ -61,6 +64,10 @@ class ImportOptionsDialog: AlertDialog {
|
|||
StateBackup.importNewPipeSubs(_context, json);
|
||||
};
|
||||
};
|
||||
_button_import_platform.onClick.subscribe {
|
||||
dismiss();
|
||||
_context.navigate(_context.getFragment<SourcesFragment>());
|
||||
};
|
||||
_button_close.setOnClickListener {
|
||||
dismiss();
|
||||
}
|
||||
|
|
|
@ -264,6 +264,31 @@ class SourceDetailFragment : MainFragment() {
|
|||
}
|
||||
)
|
||||
);
|
||||
|
||||
val migrationButtons = mutableListOf<BigButton>();
|
||||
if (isEnabled && source.capabilities.hasGetUserSubscriptions) {
|
||||
migrationButtons.add(
|
||||
BigButton(c, context.getString(R.string.import_subscriptions), context.getString(R.string.login_required), R.drawable.ic_subscriptions) {
|
||||
|
||||
}.apply { this.alpha = 0.5f }
|
||||
);
|
||||
}
|
||||
|
||||
if (isEnabled && source.capabilities.hasGetUserPlaylists && source.capabilities.hasGetPlaylist) {
|
||||
val bigButton = BigButton(c, context.getString(R.string.import_playlists), context.getString(R.string.login_required), R.drawable.ic_playlist) {
|
||||
|
||||
}.apply { this.alpha = 0.5f };
|
||||
|
||||
bigButton.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
|
||||
setMargins(0, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, resources.displayMetrics).toInt(), 0, 0);
|
||||
};
|
||||
|
||||
migrationButtons.add(bigButton);
|
||||
}
|
||||
|
||||
if (migrationButtons.size > 0) {
|
||||
groups.add(BigButtonGroup(c, context.getString(R.string.migration), *migrationButtons.toTypedArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,16 @@
|
|||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
<com.futo.platformplayer.views.buttons.BigButton
|
||||
android:id="@+id/button_import_platform"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleY="0.9"
|
||||
android:scaleX="0.9"
|
||||
app:buttonIcon="@drawable/ic_sources_filled"
|
||||
app:buttonText="Import from Platform"
|
||||
app:buttonBackground="@drawable/background_big_button_black"
|
||||
app:buttonSubText="Import your data from a specific source" />
|
||||
<com.futo.platformplayer.views.buttons.BigButton
|
||||
android:id="@+id/button_import_zip"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -70,10 +70,11 @@
|
|||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toRightOf="@id/image_thumbnail"
|
||||
app:layout_constraintLeft_toLeftOf="@id/text_body"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_body"
|
||||
android:layout_marginLeft="-10dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
@ -83,7 +84,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="10dp" />
|
||||
android:layout_marginStart="9dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_rating"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
android:textColor="@color/white"
|
||||
android:textSize="13dp"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="500K" />
|
||||
tools:text="50K" />
|
||||
|
||||
<com.futo.platformplayer.views.LoaderView
|
||||
android:id="@+id/loader_likes"
|
||||
|
@ -42,6 +42,8 @@
|
|||
android:id="@+id/pill_seperator"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="7dp"
|
||||
|
||||
android:background="#808080"/>
|
||||
|
||||
|
@ -68,7 +70,7 @@
|
|||
android:textColor="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="13dp"
|
||||
tools:text="500K" />
|
||||
tools:text="50K" />
|
||||
<com.futo.platformplayer.views.LoaderView
|
||||
android:id="@+id/loader_dislikes"
|
||||
android:layout_width="14dp"
|
||||
|
|
|
@ -577,6 +577,7 @@
|
|||
<string name="import_your_subscriptions_from_this_source">Import your subscriptions from this source</string>
|
||||
<string name="import_your_playlists_from_this_source">Import your playlists from this source</string>
|
||||
<string name="login">Login</string>
|
||||
<string name="login_required">Login Required</string>
|
||||
<string name="sign_into_the_platform_of_this_source">Sign into the platform of this source</string>
|
||||
<string name="management">Management</string>
|
||||
<string name="uninstall">Uninstall</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue