mirror of https://github.com/TeamNewPipe/NewPipe
basic login feature implemented, currently have 2 built in accounts called Account1&2, with corresponding paswword test1&2.
This commit is contained in:
parent
6f51c47dc9
commit
6f02602024
|
@ -188,6 +188,8 @@ sonar {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.annotation:annotation:1.6.0'
|
||||
|
||||
/** Desugaring **/
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.3'
|
||||
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
|
||||
<!-- We need to be able to open links in the browser on API 30+ -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <!-- We need to be able to open links in the browser on API 30+ -->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
@ -36,6 +35,16 @@
|
|||
android:resizeableActivity="true"
|
||||
android:theme="@style/OpeningTheme"
|
||||
tools:ignore="AllowBackup">
|
||||
<activity
|
||||
android:name=".settings.profile.ManageAccounts"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".settings.profile.SignInActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.login.LoginActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_login" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
@ -71,12 +80,10 @@
|
|||
android:exported="false"
|
||||
android:label="@string/title_activity_play_queue"
|
||||
android:launchMode="singleTask" />
|
||||
|
||||
<activity
|
||||
android:name=".settings.SettingsActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/settings" />
|
||||
|
||||
<activity
|
||||
android:name=".about.AboutActivity"
|
||||
android:exported="false"
|
||||
|
@ -98,18 +105,14 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ExitActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/general_error"
|
||||
android:theme="@android:style/Theme.NoDisplay" />
|
||||
|
||||
<activity
|
||||
android:name=".error.ErrorActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- giga get related -->
|
||||
android:exported="false" /> <!-- giga get related -->
|
||||
<activity
|
||||
android:name=".download.DownloadActivity"
|
||||
android:exported="false"
|
||||
|
@ -125,10 +128,10 @@
|
|||
android:theme="@style/FilePickerThemeDark">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".error.ReCaptchaActivity"
|
||||
android:exported="false"
|
||||
|
@ -319,7 +322,9 @@
|
|||
<!-- Share filter -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:mimeType="text/plain" />
|
||||
</intent-filter>
|
||||
|
||||
|
@ -337,7 +342,7 @@
|
|||
<data android:host="media.ccc.de" />
|
||||
<!-- video prefix -->
|
||||
<data android:pathPrefix="/v/" />
|
||||
<!-- channel prefix-->
|
||||
<!-- channel prefix -->
|
||||
<data android:pathPrefix="/c/" />
|
||||
<data android:pathPrefix="/b/" />
|
||||
</intent-filter>
|
||||
|
@ -353,7 +358,6 @@
|
|||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
|
||||
<data android:host="eduvid.org" />
|
||||
<data android:host="framatube.org" />
|
||||
<data android:host="media.assassinate-you.net" />
|
||||
|
@ -367,7 +371,6 @@
|
|||
<data android:host="tilvids.com" />
|
||||
<data android:host="video.lqdn.fr" />
|
||||
<data android:host="video.ploud.fr" />
|
||||
|
||||
<data android:pathPrefix="/videos/" /> <!-- it contains playlists -->
|
||||
<data android:pathPrefix="/w/" /> <!-- short video URLs -->
|
||||
<data android:pathPrefix="/w/p/" /> <!-- short playlist URLs -->
|
||||
|
@ -404,24 +407,21 @@
|
|||
<data android:scheme="https" />
|
||||
<data android:sspPattern="bandcamp.com/?show=*" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".RouterActivity$FetcherService"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- opting out of sending metrics to Google in Android System WebView -->
|
||||
android:exported="false" /> <!-- opting out of sending metrics to Google in Android System WebView -->
|
||||
<meta-data
|
||||
android:name="android.webkit.WebView.MetricsOptOut"
|
||||
android:value="true" />
|
||||
<!-- see https://github.com/TeamNewPipe/NewPipe/issues/3947 -->
|
||||
android:value="true" /> <!-- see https://github.com/TeamNewPipe/NewPipe/issues/3947 -->
|
||||
<!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
|
||||
<meta-data
|
||||
android:name="com.samsung.android.keepalive.density"
|
||||
android:value="true" />
|
||||
<!-- Version >= 3.0. DeX Dual Mode support -->
|
||||
android:value="true" /> <!-- Version >= 3.0. DeX Dual Mode support -->
|
||||
<meta-data
|
||||
android:name="com.samsung.android.multidisplay.keep_process_alive"
|
||||
android:value="true" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,50 @@
|
|||
package org.schabi.newpipe.settings;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.settings.profile.ManageAccounts;
|
||||
import org.schabi.newpipe.settings.profile.SignInActivity;
|
||||
|
||||
public class AccountSettingsFragment extends BasePreferenceFragment {
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
|
||||
addPreferencesFromResourceRegistry();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(final Preference preference) {
|
||||
if (getString(R.string.sign_in).equals(preference.getKey())) {
|
||||
try {
|
||||
final Intent intent = new Intent(requireContext(), SignInActivity.class);
|
||||
startActivity(intent);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
// if (getString(R.string.sign_out).equals(preference.getKey())) {
|
||||
// try {
|
||||
// startActivity(new Intent(Settings.ACTION_CAPTIONING_SETTINGS));
|
||||
// } catch (final ActivityNotFoundException e) {
|
||||
// Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
// }
|
||||
if (getString(R.string.manage_accounts).equals(preference.getKey())) {
|
||||
try {
|
||||
final Intent intent = new Intent(requireContext(), ManageAccounts.class);
|
||||
startActivity(intent);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ public final class SettingsResourceRegistry {
|
|||
add(UpdateSettingsFragment.class, R.xml.update_settings);
|
||||
add(VideoAudioSettingsFragment.class, R.xml.video_audio_settings);
|
||||
add(ExoPlayerSettingsFragment.class, R.xml.exoplayer_settings);
|
||||
add(AccountSettingsFragment.class, R.xml.account_settings);
|
||||
}
|
||||
|
||||
private SettingRegistryEntry add(
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package org.schabi.newpipe.settings.profile;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.settings.BasePreferenceFragment;
|
||||
|
||||
public class ManageAccounts extends BasePreferenceFragment {
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
|
||||
addPreferencesFromResourceRegistry();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(final Preference preference) {
|
||||
if (getString(R.string.sign_in).equals(preference.getKey())) {
|
||||
try {
|
||||
final Intent intent = new Intent(requireContext(), SignInActivity.class);
|
||||
startActivity(intent);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
// if (getString(R.string.sign_out).equals(preference.getKey())) {
|
||||
// try {
|
||||
// startActivity(new Intent(Settings.ACTION_CAPTIONING_SETTINGS));
|
||||
// } catch (final ActivityNotFoundException e) {
|
||||
// Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
// }
|
||||
if (getString(R.string.manage_accounts).equals(preference.getKey())) {
|
||||
try {
|
||||
final Intent intent = new Intent(requireContext(), ManageAccounts.class);
|
||||
startActivity(intent);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
Toast.makeText(getActivity(), R.string.general_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,160 @@
|
|||
package org.schabi.newpipe.settings.profile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
|
||||
public class SignInActivity extends AppCompatActivity {
|
||||
|
||||
private EditText etUsername;
|
||||
private EditText etPassword;
|
||||
private Button btLogin;
|
||||
private Button btRegister;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sign_in);
|
||||
btLogin = findViewById(R.id.buttonLogin);
|
||||
btRegister = findViewById(R.id.buttonRegister);
|
||||
etUsername = findViewById(R.id.usernameEditText);
|
||||
etPassword = findViewById(R.id.passwordEditText);
|
||||
|
||||
btLogin.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
|
||||
final String enteredUsername = etUsername.getText().toString();
|
||||
final String enteredPassword = etPassword.getText().toString();
|
||||
|
||||
if (authenticateUser(SignInActivity.this,
|
||||
enteredUsername, enteredPassword)) {
|
||||
// Successful
|
||||
Toast.makeText(SignInActivity.this, "Login successful",
|
||||
Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
final Intent intent = new Intent(SignInActivity.this,
|
||||
MainActivity.class);
|
||||
intent.putExtra("username", enteredUsername);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
// Incorrect credentials
|
||||
Toast.makeText(SignInActivity.this,
|
||||
"Invalid username or password", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btRegister.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
|
||||
final String username = etUsername.getText().toString().trim();
|
||||
final String password = etPassword.getText().toString().trim();
|
||||
|
||||
// Check if username and password are not empty
|
||||
if (!username.isEmpty() && !password.isEmpty()) {
|
||||
|
||||
final boolean registrationSuccessful = registerUser(username, password);
|
||||
|
||||
if (registrationSuccessful) {
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Registration successful",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Registration failed",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
|
||||
Toast.makeText(getApplicationContext(),
|
||||
"Please enter both username and password",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean authenticateUser(final Context context,
|
||||
final String username, final String password) {
|
||||
try {
|
||||
final InputStream inputStream = context.getResources()
|
||||
.openRawResource(R.raw.credentials);
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String line;
|
||||
System.out.println(inputStream);
|
||||
while ((line = reader.readLine()) != null) {
|
||||
line = line.replace("*", "").trim();
|
||||
final String[] fields = line.split("\\|\\|");
|
||||
|
||||
boolean usernameCorrect = false;
|
||||
boolean passwordCorrect = false;
|
||||
|
||||
for (final String field : fields) {
|
||||
final String[] keyValue = field.split("=");
|
||||
if (keyValue.length == 2) {
|
||||
final String key = keyValue[0].trim();
|
||||
final String value = keyValue[1].trim();
|
||||
|
||||
if (key.equals("username") && value.equals(username)) {
|
||||
usernameCorrect = true;
|
||||
} else if (key.equals("password") && value.equals(password)) {
|
||||
passwordCorrect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usernameCorrect && passwordCorrect) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
reader.close();
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean registerUser(final String username, final String password) {
|
||||
try {
|
||||
|
||||
final FileOutputStream fos = openFileOutput("credentials.txt",
|
||||
Context.MODE_APPEND);
|
||||
|
||||
|
||||
final String newCredentials = "*username=" + username
|
||||
+ "||password=" + password + "*\n";
|
||||
|
||||
fos.write(newCredentials.getBytes());
|
||||
|
||||
fos.close();
|
||||
|
||||
return true;
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context=".settings.ui.login.LoginActivity">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="96dp"
|
||||
android:hint="@string/prompt_email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:selectAllOnFocus="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/prompt_password"
|
||||
android:imeActionLabel="@string/action_sign_in_short"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:selectAllOnFocus="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/username" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/action_sign_in"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/password"
|
||||
app:layout_constraintVertical_bias="0.2" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="64dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/password"
|
||||
app:layout_constraintStart_toStartOf="@+id/password"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.3" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context=".settings.ui.login.LoginActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="840dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="96dp"
|
||||
android:hint="@string/prompt_email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:selectAllOnFocus="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/prompt_password"
|
||||
android:imeActionLabel="@string/action_sign_in_short"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:selectAllOnFocus="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/username" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/action_sign_in"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/password"
|
||||
app:layout_constraintVertical_bias="0.2" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="64dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/password"
|
||||
app:layout_constraintStart_toStartOf="@+id/password"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.3" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context=".settings.ui.login.LoginActivity">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="96dp"
|
||||
android:hint="@string/prompt_email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:selectAllOnFocus="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/prompt_password"
|
||||
android:imeActionLabel="@string/action_sign_in_short"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:selectAllOnFocus="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/username" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/action_sign_in"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/password"
|
||||
app:layout_constraintVertical_bias="0.2" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="64dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/password"
|
||||
app:layout_constraintStart_toStartOf="@+id/password"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.3" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passwordEditText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="Password"
|
||||
android:textColorHint="@color/white"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toTopOf="@+id/buttonLogin"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/usernameEditText"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/usernameEditText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="Username"
|
||||
android:textColorHint="@color/white"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toTopOf="@+id/passwordEditText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/NewPipe_textView"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonLogin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="LOGIN"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/buttonRegister"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passwordEditText"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonRegister"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="New User"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/buttonLogin"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passwordEditText"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/NewPipe_textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NewPipe"
|
||||
android:textAppearance="@style/PlayQueueItemTitle"
|
||||
app:layout_constraintBottom_toTopOf="@+id/usernameEditText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,2 @@
|
|||
*username=Account1||password=test1*
|
||||
*username=Account2||password=test2*
|
|
@ -0,0 +1,2 @@
|
|||
*username=Account1||www.google.com||www.yahoo.com*
|
||||
*username=Account2||www.bing.com||www.duckduckgo.com*
|
|
@ -55,4 +55,5 @@
|
|||
<dimen name="search_suggestion_text_size">14sp</dimen>
|
||||
|
||||
<dimen name="comment_item_avatar_right_margin">13dp</dimen>
|
||||
<dimen name="activity_horizontal_margin">48dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<dimen name="activity_horizontal_margin">200dp</dimen>
|
||||
</resources>
|
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<dimen name="activity_horizontal_margin">48dp</dimen>
|
||||
</resources>
|
|
@ -551,6 +551,11 @@
|
|||
<string name="streams_notifications_interval_title">Checking frequency</string>
|
||||
<string name="streams_notifications_network_title">Required network connection</string>
|
||||
<string name="any_network">Any network</string>
|
||||
<!-- Account settings -->
|
||||
<string name="create_account">Create account</string>
|
||||
<string name="sign_in">Sign in another account</string>
|
||||
<string name="sign_out">Sign out</string>
|
||||
<string name="manage_accounts">Manage accounts</string>
|
||||
<!-- Updates Settings -->
|
||||
<string name="updates_setting_title">Updates</string>
|
||||
<string name="updates_setting_description">Show a notification to prompt app update when a new version is available</string>
|
||||
|
@ -740,6 +745,7 @@
|
|||
<string name="paid_content">This content is only available to users who have paid, so it cannot be streamed or downloaded by NewPipe.</string>
|
||||
<string name="featured">Featured</string>
|
||||
<string name="radio">Radio</string>
|
||||
<string name="accounts">Accounts</string>
|
||||
<string name="auto_device_theme_title">Automatic (device theme)</string>
|
||||
<string name="night_theme_summary">Select your favorite night theme — %s</string>
|
||||
<string name="select_night_theme_toast">You can select your favorite night theme below</string>
|
||||
|
@ -838,4 +844,13 @@
|
|||
<string name="share_playlist_with_list">Share URL list</string>
|
||||
<string name="video_details_list_item">- %1$s: %2$s</string>
|
||||
<string name="share_playlist_content_details">%1$s\n%2$s</string>
|
||||
<string name="title_activity_login">LoginActivity</string>
|
||||
<string name="prompt_email">Email</string>
|
||||
<string name="prompt_password">Password</string>
|
||||
<string name="action_sign_in">Sign in or register</string>
|
||||
<string name="action_sign_in_short">Sign in</string>
|
||||
<string name="welcome">"Welcome !"</string>
|
||||
<string name="invalid_username">Not a valid username</string>
|
||||
<string name="invalid_password">Password must be >5 characters</string>
|
||||
<string name="login_failed">"Login failed"</string>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/accounts">
|
||||
|
||||
<Preference
|
||||
android:key="@string/sign_in"
|
||||
android:title="@string/sign_in"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/manage_accounts"
|
||||
android:title="@string/manage_accounts"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
</PreferenceScreen>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/manage_accounts">
|
||||
|
||||
<Preference
|
||||
android:key="@string/sign_in"
|
||||
android:title="@string/sign_in"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
<Preference
|
||||
android:key="@string/sign_out"
|
||||
android:title="@string/sign_out"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
<Preference
|
||||
android:key="@string/manage_accounts"
|
||||
android:title="@string/manage_accounts"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
</PreferenceScreen>
|
|
@ -47,10 +47,17 @@
|
|||
android:title="@string/settings_category_updates_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:fragment="org.schabi.newpipe.settings.AccountSettingsFragment"
|
||||
android:icon="@drawable/ic_child_care"
|
||||
android:title="@string/accounts"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:fragment="org.schabi.newpipe.settings.DebugSettingsFragment"
|
||||
android:icon="@drawable/ic_bug_report"
|
||||
android:key="@string/debug_pref_screen_key"
|
||||
android:title="@string/settings_category_debug_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
## For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
#
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
#
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
#Thu Oct 12 02:17:31 AEDT 2023
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.enableJetifier=false
|
||||
android.nonFinalResIds=false
|
||||
android.nonTransitiveRClass=false
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx2048M --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
|
||||
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" --add-opens jdk.compiler/com.sun.tools.javac.model\=ALL-UNNAMED
|
||||
systemProp.file.encoding=utf-8
|
||||
|
|
Loading…
Reference in New Issue