1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 00:20:32 +00:00

fix drawer header service label noch chaning, and other things

This commit is contained in:
Christian Schabesberger 2018-02-19 21:04:13 +01:00
parent 3e5e7f49cc
commit 212f7dfc93
4 changed files with 1268 additions and 3 deletions

View File

@ -47,11 +47,13 @@ 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;
@ -151,8 +153,11 @@ public class MainActivity extends AppCompatActivity {
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());
action.setOnClickListener(view -> {
Toast.makeText(this,
R.string.drawer_header_action_paceholder_text, Toast.LENGTH_SHORT).show();
drawer.closeDrawers();
});
}
@Override
@ -170,6 +175,13 @@ public class MainActivity extends AppCompatActivity {
// 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)) {

View File

@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -20,6 +21,6 @@
<include layout="@layout/toolbar_layout" />
</FrameLayout>
<include layout="@layout/drawer_laoyut"/>
<include layout="@layout/drawer_layout"/>
</android.support.v4.widget.DrawerLayout>

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 102 KiB