fix scrolling in article images pager when images are zoomed

remove statusbar tint library
This commit is contained in:
Andrew Dolgov 2014-11-25 12:31:25 +03:00
parent 4ac2b72796
commit ce635408a5
11 changed files with 41 additions and 39 deletions

View File

@ -27,7 +27,6 @@ dependencies {
compile files('libs/dashclock-api-r1.1.jar') compile files('libs/dashclock-api-r1.1.jar')
compile files('libs/jsoup-1.6.1.jar') compile files('libs/jsoup-1.6.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar') compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.viewpagerindicator:library:2.4.1' compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.android.support:cardview-v7:21.0.0' compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:support-v4:21.0.0' compile 'com.android.support:support-v4:21.0.0'

View File

@ -85,7 +85,6 @@
<orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" /> <orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.1" level="project" /> <orderEntry type="library" exported="" name="library-2.4.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="systembartint-1.0.3" level="project" />
<orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" /> <orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
<orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" /> <orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" />

View File

@ -0,0 +1,39 @@
package org.fox.ttrss;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import it.sephiroth.android.library.imagezoom.ImageViewTouch;
public class ArticleImagesPager extends android.support.v4.view.ViewPager {
public ArticleImagesPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof ImageViewTouch) {
ImageViewTouch ivt = (ImageViewTouch) v;
try {
return ivt.canScroll(dx);
} catch (NullPointerException e) {
// bad image, etc
return false;
}
} else {
return super.canScroll(v, checkV, dx, x, y);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return super.onInterceptTouchEvent(event);
}
}

View File

@ -23,7 +23,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
@ -238,8 +237,6 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
setContentView(R.layout.article_images_pager); setContentView(R.layout.article_images_pager);
setStatusBarTint();
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (savedInstanceState == null) { if (savedInstanceState == null) {

View File

@ -9,14 +9,10 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.util.Log; import android.util.Log;
import android.util.TypedValue;
import android.view.Display; import android.view.Display;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.Toast; import android.widget.Toast;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import org.fox.ttrss.util.DatabaseHelper; import org.fox.ttrss.util.DatabaseHelper;
public class CommonActivity extends ActionBarActivity { public class CommonActivity extends ActionBarActivity {
@ -155,24 +151,6 @@ public class CommonActivity extends ActionBarActivity {
return Math.round((float)dp * density); return Math.round((float)dp * density);
} }
public void setStatusBarTint() {
if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.KITKAT &&
!m_prefs.getBoolean("full_screen_mode", false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
TypedValue tv = new TypedValue();
getTheme().resolveAttribute(R.attr.statusBarHintColor, tv, true);
tintManager.setStatusBarTintColor(tv.data);
}
}
@Override @Override
public void onSaveInstanceState(Bundle out) { public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out); super.onSaveInstanceState(out);

View File

@ -55,7 +55,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
setContentView(R.layout.headlines); setContentView(R.layout.headlines);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);

View File

@ -7,11 +7,8 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import org.fox.ttrss.types.Article; import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.ArticleList;
@ -37,7 +34,6 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);

View File

@ -165,8 +165,6 @@ public class OnlineActivity extends CommonActivity {
setContentView(R.layout.login); setContentView(R.layout.login);
setStatusBarTint();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.diskCache( .diskCache(
new LimitedAgeDiscCache(new File(StorageUtils.getCacheDirectory(getApplicationContext()), "article-images"), new LimitedAgeDiscCache(new File(StorageUtils.getCacheDirectory(getApplicationContext()), "article-images"),

View File

@ -46,7 +46,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
setContentView(R.layout.headlines); setContentView(R.layout.headlines);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);

View File

@ -67,7 +67,6 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
/* if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) { /* if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) {

View File

@ -10,12 +10,11 @@
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"> */ android:paddingBottom="@dimen/activity_vertical_margin"> */
<android.support.v4.view.ViewPager <org.fox.ttrss.ArticleImagesPager
android:id="@+id/article_images_pager" android:id="@+id/article_images_pager"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" > android:layout_height="fill_parent" />
</android.support.v4.view.ViewPager>
<com.viewpagerindicator.UnderlinePageIndicator <com.viewpagerindicator.UnderlinePageIndicator
android:id="@+id/article_images_indicator" android:id="@+id/article_images_indicator"