diff --git a/app/build.gradle b/app/build.gradle
index 4e8115af5..16609fbab 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "org.schabi.newpipe"
minSdkVersion 15
targetSdkVersion 27
- versionCode 47
- versionName "0.11.6"
+ versionCode 48
+ versionName "0.12.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
@@ -55,7 +55,7 @@ dependencies {
exclude module: 'support-annotations'
}
- implementation 'com.github.TeamNewPipe:NewPipeExtractor:e51bc58a856dcf3'
+ implementation 'com.github.TeamNewPipe:NewPipeExtractor:7716b1437815'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java
index cbd2bacaa..ac058f52c 100644
--- a/app/src/main/java/org/schabi/newpipe/MainActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java
@@ -37,19 +37,23 @@ import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
+import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
+import android.widget.TextView;
import android.widget.Toast;
+import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.fragments.BackPressable;
import org.schabi.newpipe.fragments.MainFragment;
import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
import org.schabi.newpipe.fragments.list.search.SearchFragment;
+import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ServiceHelper;
@@ -61,6 +65,9 @@ public class MainActivity extends AppCompatActivity {
public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");
private ActionBarDrawerToggle toggle = null;
+ private DrawerLayout drawer = null;
+ private NavigationView drawerItems = null;
+ private TextView headerServiceView = null;
/*//////////////////////////////////////////////////////////////////////////
// Activity's LifeCycle
@@ -81,13 +88,12 @@ public class MainActivity extends AppCompatActivity {
setSupportActionBar(findViewById(R.id.toolbar));
setupDrawer();
- setupDrawerFooter();
}
private void setupDrawer() {
final Toolbar toolbar = findViewById(R.id.toolbar);
- final DrawerLayout drawer = findViewById(R.id.drawer_layout);
- final NavigationView drawerItems = findViewById(R.id.navigation);
+ drawer = findViewById(R.id.drawer_layout);
+ drawerItems = findViewById(R.id.navigation);
//drawerItems.setItemIconTintList(null); // Set null to use the original icon
drawerItems.getMenu().getItem(ServiceHelper.getSelectedServiceId(this)).setChecked(true);
@@ -112,30 +118,48 @@ public class MainActivity extends AppCompatActivity {
}
});
- drawerItems.setNavigationItemSelectedListener(item -> {
- if (item.getGroupId() == R.id.menu_services_group) {
- drawerItems.getMenu().getItem(ServiceHelper.getSelectedServiceId(this)).setChecked(false);
- ServiceHelper.setSelectedServiceId(this, item.getTitle().toString());
- drawerItems.getMenu().getItem(ServiceHelper.getSelectedServiceId(this)).setChecked(true);
- }
- drawer.closeDrawers();
- return true;
- });
+ drawerItems.setNavigationItemSelectedListener(this::changeService);
+
+ setupDrawerFooter();
+ setupDrawerHeader();
} else {
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
}
+ private boolean changeService(MenuItem item) {
+ if (item.getGroupId() == R.id.menu_services_group) {
+ drawerItems.getMenu().getItem(ServiceHelper.getSelectedServiceId(this)).setChecked(false);
+ ServiceHelper.setSelectedServiceId(this, item.getTitle().toString());
+ drawerItems.getMenu().getItem(ServiceHelper.getSelectedServiceId(this)).setChecked(true);
+ headerServiceView.setText("gurken");
+ } else {
+ return false;
+ }
+ drawer.closeDrawers();
+ return true;
+ }
+
private void setupDrawerFooter() {
ImageButton settings = findViewById(R.id.drawer_settings);
ImageButton downloads = findViewById(R.id.drawer_downloads);
ImageButton history = findViewById(R.id.drawer_history);
- settings.setOnClickListener(view -> NavigationHelper.openSettings(this) );
- downloads.setOnClickListener(view -> NavigationHelper.openDownloads(this));
+ settings.setOnClickListener(view -> NavigationHelper.openSettings(this));
+ downloads.setOnClickListener(view ->NavigationHelper.openDownloads(this));
history.setOnClickListener(view -> NavigationHelper.openHistory(this));
}
+ private void setupDrawerHeader() {
+ headerServiceView = findViewById(R.id.drawer_header_service_view);
+ Button action = findViewById(R.id.drawer_header_action_button);
+ action.setOnClickListener(view -> {
+ Toast.makeText(this,
+ R.string.drawer_header_action_paceholder_text, Toast.LENGTH_SHORT).show();
+ drawer.closeDrawers();
+ });
+ }
+
@Override
protected void onDestroy() {
super.onDestroy();
@@ -148,6 +172,17 @@ public class MainActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
+ // close drawer on return, and don't show animation, so its looks like the drawer isn't open
+ // when the user returns to MainActivity
+ drawer.closeDrawer(Gravity.START, false);
+ try {
+ String selectedServiceName = NewPipe.getService(
+ ServiceHelper.getSelectedServiceId(this)).getServiceInfo().getName();
+ headerServiceView.setText(selectedServiceName);
+ } catch (Exception e) {
+ ErrorActivity.reportUiError(this, e);
+ }
+
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (sharedPreferences.getBoolean(Constants.KEY_THEME_CHANGE, false)) {
if (DEBUG) Log.d(TAG, "Theme has changed, recreating activity...");
diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java
index 5ab1ed1f2..00b618889 100644
--- a/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java
@@ -13,6 +13,7 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
+import org.schabi.newpipe.MainActivity;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.ServiceList;
@@ -45,6 +46,8 @@ import java.util.Vector;
public class SelectKioskFragment extends DialogFragment {
+ private static final boolean DEBUG = MainActivity.DEBUG;
+
RecyclerView recyclerView = null;
SelectKioskAdapter selectKioskAdapter = null;
@@ -122,7 +125,7 @@ public class SelectKioskFragment extends DialogFragment {
for(StreamingService service : NewPipe.getServices()) {
//TODO: Multi-service support
- if (service.getServiceId() != ServiceList.YouTube.getServiceId()) continue;
+ if (service.getServiceId() != ServiceList.YouTube.getServiceId() && !DEBUG) continue;
for(String kioskId : service.getKioskList().getAvailableKiosks()) {
String name = String.format(getString(R.string.service_kiosk_string),
diff --git a/app/src/main/res/drawable-nodpi/background_header.png b/app/src/main/res/drawable-nodpi/background_header.png
new file mode 100644
index 000000000..b417038f6
Binary files /dev/null and b/app/src/main/res/drawable-nodpi/background_header.png differ
diff --git a/app/src/main/res/drawable-nodpi/np_logo_nude_shadow.png b/app/src/main/res/drawable-nodpi/np_logo_nude_shadow.png
new file mode 100644
index 000000000..99b91d374
Binary files /dev/null and b/app/src/main/res/drawable-nodpi/np_logo_nude_shadow.png differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index b894c23aa..99c637389 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/drawer_laoyut.xml b/app/src/main/res/layout/drawer_layout.xml
similarity index 51%
rename from app/src/main/res/layout/drawer_laoyut.xml
rename to app/src/main/res/layout/drawer_layout.xml
index dcf29c42f..aba90430c 100644
--- a/app/src/main/res/layout/drawer_laoyut.xml
+++ b/app/src/main/res/layout/drawer_layout.xml
@@ -6,9 +6,11 @@
android:layout_width="wrap_content"
android:layout_gravity="start"
xmlns:app="http://schemas.android.com/apk/res-auto"
- android:background="?attr/android:windowBackground">
+ android:background="?attr/android:windowBackground"
+ android:clickable="true"
+ android:focusable="true">
-
+ android:clickable="true"
+ android:focusable="true">
+
+
+
+
+
+
+
+
+
+
+
+
Close Drawer
YouTube
SoundCloud
+ Something will come here soon ;D
diff --git a/assets/NewPipe_background_just1.svg b/assets/NewPipe_background_just1.svg
new file mode 100644
index 000000000..dae3db6b3
--- /dev/null
+++ b/assets/NewPipe_background_just1.svg
@@ -0,0 +1,1252 @@
+
+
+
+