Icons in main tabs, improved video activity a bit
This commit is contained in:
parent
b3b3f2a88d
commit
f508e8bc34
10 changed files with 85 additions and 12 deletions
|
@ -20,6 +20,7 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
@ -27,6 +28,7 @@ import android.os.SystemClock;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
@ -121,6 +123,10 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
tabLayout.getTabAt(0).setIcon(R.drawable.ic_home_24dp);
|
||||
tabLayout.getTabAt(1).setIcon(R.drawable.ic_notifications_24dp);
|
||||
tabLayout.getTabAt(2).setIcon(R.drawable.ic_public_24dp);
|
||||
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
|
@ -135,11 +141,12 @@ public class MainActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
pageHistory.push(tab.getPosition());
|
||||
tintTab(tab, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
tintTab(tab, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,7 +162,12 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
if (tabPosition != 0) {
|
||||
tabLayout.getTabAt(tabPosition).select();
|
||||
tintTab(tabLayout.getTabAt(tabPosition), true);
|
||||
} else {
|
||||
tintTab(tabLayout.getTabAt(0), true);
|
||||
}
|
||||
} else {
|
||||
tintTab(tabLayout.getTabAt(0), true);
|
||||
}
|
||||
|
||||
// Setup push notifications
|
||||
|
@ -172,6 +184,10 @@ public class MainActivity extends BaseActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private void tintTab(TabLayout.Tab tab, boolean tinted) {
|
||||
tab.getIcon().setColorFilter(ContextCompat.getColor(this, tinted ? R.color.color_accent_dark : R.color.toolbar_icon_dark), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
private void setupDrawer() {
|
||||
headerResult = new AccountHeaderBuilder()
|
||||
.withActivity(this)
|
||||
|
|
|
@ -206,7 +206,6 @@ public class SFragment extends Fragment {
|
|||
|
||||
FragmentManager manager = getFragmentManager();
|
||||
manager.beginTransaction()
|
||||
.setCustomAnimations(R.anim.zoom_in, R.anim.zoom_out, R.anim.zoom_in, R.anim.zoom_out)
|
||||
.add(R.id.overlay_fragment_container, newFragment)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
|
|
|
@ -55,6 +55,6 @@ class TimelinePagerAdapter extends FragmentPagerAdapter {
|
|||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return pageTitles[position];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,21 +16,53 @@
|
|||
package com.keylesspalace.tusky;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.MediaController;
|
||||
import android.widget.VideoView;
|
||||
|
||||
public class ViewVideoActivity extends AppCompatActivity {
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class ViewVideoActivity extends BaseActivity {
|
||||
@BindView(R.id.video_player) VideoView videoView;
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_video);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ActionBar bar = getSupportActionBar();
|
||||
|
||||
if (bar != null) {
|
||||
bar.setTitle(null);
|
||||
bar.setDisplayHomeAsUpEnabled(true);
|
||||
bar.setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
String url = getIntent().getStringExtra("url");
|
||||
VideoView videoView = (VideoView) findViewById(R.id.video_player);
|
||||
|
||||
videoView.setVideoPath(url);
|
||||
MediaController controller = new MediaController(this);
|
||||
videoView.setMediaController(controller);
|
||||
controller.show();
|
||||
videoView.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home: {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue