Icons in main tabs, improved video activity a bit

main
Eugen Rochko 8 years ago
parent b3b3f2a88d
commit f508e8bc34
  1. 2
      app/src/main/AndroidManifest.xml
  2. 18
      app/src/main/java/com/keylesspalace/tusky/MainActivity.java
  3. 1
      app/src/main/java/com/keylesspalace/tusky/SFragment.java
  4. 2
      app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java
  5. 36
      app/src/main/java/com/keylesspalace/tusky/ViewVideoActivity.java
  6. 9
      app/src/main/res/drawable/ic_home_24dp.xml
  7. 9
      app/src/main/res/drawable/ic_notifications_24dp.xml
  8. 2
      app/src/main/res/drawable/ic_public_24dp.xml
  9. 2
      app/src/main/res/layout/activity_view_thread.xml
  10. 16
      app/src/main/res/layout/activity_view_video.xml

@ -37,7 +37,7 @@
<activity <activity
android:name=".ComposeActivity" android:name=".ComposeActivity"
android:windowSoftInputMode="stateVisible|adjustResize" /> android:windowSoftInputMode="stateVisible|adjustResize" />
<activity android:name=".ViewVideoActivity" /> <activity android:name=".ViewVideoActivity" android:configChanges="orientation|keyboardHidden|screenSize" />
<activity android:name=".ViewThreadActivity" /> <activity android:name=".ViewThreadActivity" />
<activity android:name=".ViewTagActivity" /> <activity android:name=".ViewTagActivity" />
<activity android:name=".AccountActivity" /> <activity android:name=".AccountActivity" />

@ -20,6 +20,7 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
@ -27,6 +28,7 @@ import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
@ -121,6 +123,10 @@ public class MainActivity extends BaseActivity {
tabLayout.setupWithViewPager(viewPager); 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() { tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override @Override
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(TabLayout.Tab tab) {
@ -135,11 +141,12 @@ public class MainActivity extends BaseActivity {
} }
pageHistory.push(tab.getPosition()); pageHistory.push(tab.getPosition());
tintTab(tab, true);
} }
@Override @Override
public void onTabUnselected(TabLayout.Tab tab) { public void onTabUnselected(TabLayout.Tab tab) {
tintTab(tab, false);
} }
@Override @Override
@ -155,7 +162,12 @@ public class MainActivity extends BaseActivity {
if (tabPosition != 0) { if (tabPosition != 0) {
tabLayout.getTabAt(tabPosition).select(); tabLayout.getTabAt(tabPosition).select();
tintTab(tabLayout.getTabAt(tabPosition), true);
} else {
tintTab(tabLayout.getTabAt(0), true);
} }
} else {
tintTab(tabLayout.getTabAt(0), true);
} }
// Setup push notifications // 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() { private void setupDrawer() {
headerResult = new AccountHeaderBuilder() headerResult = new AccountHeaderBuilder()
.withActivity(this) .withActivity(this)

@ -206,7 +206,6 @@ public class SFragment extends Fragment {
FragmentManager manager = getFragmentManager(); FragmentManager manager = getFragmentManager();
manager.beginTransaction() 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) .add(R.id.overlay_fragment_container, newFragment)
.addToBackStack(null) .addToBackStack(null)
.commit(); .commit();

@ -55,6 +55,6 @@ class TimelinePagerAdapter extends FragmentPagerAdapter {
@Override @Override
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
return pageTitles[position]; return null;
} }
} }

@ -16,21 +16,53 @@
package com.keylesspalace.tusky; package com.keylesspalace.tusky;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.MediaController; import android.widget.MediaController;
import android.widget.VideoView; 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 @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_video); 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"); String url = getIntent().getStringExtra("url");
VideoView videoView = (VideoView) findViewById(R.id.video_player);
videoView.setVideoPath(url); videoView.setVideoPath(url);
MediaController controller = new MediaController(this); MediaController controller = new MediaController(this);
videoView.setMediaController(controller); videoView.setMediaController(controller);
controller.show(); controller.show();
videoView.start(); videoView.start();
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home: {
onBackPressed();
return true;
}
}
return super.onOptionsItemSelected(item);
}
} }

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/toolbar_icon_dark"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/toolbar_icon_dark"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z"/>
</vector>

@ -4,6 +4,6 @@
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="#FF000000" android:fillColor="@color/toolbar_icon_dark"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/> android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>
</vector> </vector>

@ -25,14 +25,12 @@
android:id="@+id/fragment_container" android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/overlay_fragment_container" android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
</FrameLayout> </FrameLayout>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

@ -1,14 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/view_video_background"> android:background="@color/view_video_background"
tools:context=".ViewVideoActivity">
<VideoView <VideoView
android:id="@+id/video_player" android:id="@+id/video_player"
android:layout_marginTop="?attr/actionBarSize"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_centerInParent="true" /> android:layout_centerInParent="true" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:elevation="4dp"
android:background="@color/semi_transparent" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>
Loading…
Cancel
Save