mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fit overlays on 360dp screens. Move progress indicator to overlay. Add progress indicator for text mode.
This commit is contained in:
parent
d11654b47d
commit
bf487be255
2 changed files with 57 additions and 17 deletions
|
@ -25,8 +25,8 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/reading_overlay_text"
|
||||
android:layout_width="113dp"
|
||||
android:layout_height="41dp"
|
||||
android:layout_width="110.6dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/overlay_text"
|
||||
android:text="@string/overlay_text"
|
||||
android:textColor="@color/half_darkgray"
|
||||
|
@ -34,14 +34,14 @@
|
|||
android:gravity="left|center_vertical"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingLeft="46dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="6dp"
|
||||
android:onClick="overlayText" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/reading_overlay_send"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="41dp"
|
||||
android:layout_width="51.8dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/overlay_send"
|
||||
android:textSize="14sp"
|
||||
android:padding="6dp"
|
||||
|
@ -61,8 +61,8 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/reading_overlay_left"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="41dp"
|
||||
android:layout_width="50.6dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/selector_overlay_bg_left"
|
||||
android:textSize="14sp"
|
||||
android:padding="6dp"
|
||||
|
@ -71,8 +71,8 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/reading_overlay_right"
|
||||
android:layout_width="125dp"
|
||||
android:layout_height="41dp"
|
||||
android:layout_width="122.4dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/selector_overlay_bg_right"
|
||||
android:text="@string/overlay_next"
|
||||
android:textColor="@color/half_darkgray"
|
||||
|
@ -85,12 +85,32 @@
|
|||
<com.newsblur.view.ProgressCircle
|
||||
android:id="@+id/reading_overlay_progress"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_marginRight="99dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="98dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:onClick="overlayCount" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/reading_overlay_progress_right"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="98dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:indeterminate="true" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/reading_overlay_progress_left"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="90dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:indeterminate="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
private static final int OVERLAY_RANGE_BOT_DP = 60;
|
||||
|
||||
/** The minimum screen width (in DP) needed to show all the overlay controls. */
|
||||
private static final int OVERLAY_MIN_WIDTH_DP = 362;
|
||||
private static final int OVERLAY_MIN_WIDTH_DP = 355;
|
||||
|
||||
/** The longest time (in seconds) the UI will wait for API pages to load while
|
||||
searching for the next unread story. */
|
||||
|
@ -75,7 +75,7 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
|
||||
protected ViewPager pager;
|
||||
protected Button overlayLeft, overlayRight;
|
||||
protected ProgressBar overlayProgress;
|
||||
protected ProgressBar overlayProgress, overlayProgressRight, overlayProgressLeft;
|
||||
protected Button overlayText, overlaySend;
|
||||
protected FragmentManager fragmentManager;
|
||||
protected ReadingAdapter readingAdapter;
|
||||
|
@ -113,6 +113,8 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
this.overlayLeft = (Button) findViewById(R.id.reading_overlay_left);
|
||||
this.overlayRight = (Button) findViewById(R.id.reading_overlay_right);
|
||||
this.overlayProgress = (ProgressBar) findViewById(R.id.reading_overlay_progress);
|
||||
this.overlayProgressRight = (ProgressBar) findViewById(R.id.reading_overlay_progress_right);
|
||||
this.overlayProgressLeft = (ProgressBar) findViewById(R.id.reading_overlay_progress_left);
|
||||
this.overlayText = (Button) findViewById(R.id.reading_overlay_text);
|
||||
this.overlaySend = (Button) findViewById(R.id.reading_overlay_send);
|
||||
|
||||
|
@ -134,6 +136,7 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
|
||||
this.pageHistory = new ArrayList<Story>();
|
||||
|
||||
enableProgressCircle(overlayProgressLeft, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -263,6 +266,8 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
UIUtils.setViewAlpha(this.overlayLeft, a);
|
||||
UIUtils.setViewAlpha(this.overlayRight, a);
|
||||
UIUtils.setViewAlpha(this.overlayProgress, a);
|
||||
UIUtils.setViewAlpha(this.overlayProgressLeft, a);
|
||||
UIUtils.setViewAlpha(this.overlayProgressRight, a);
|
||||
UIUtils.setViewAlpha(this.overlayText, a);
|
||||
UIUtils.setViewAlpha(this.overlaySend, a);
|
||||
}
|
||||
|
@ -365,13 +370,23 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
|
||||
@Override
|
||||
public void updateSyncStatus(final boolean syncRunning) {
|
||||
enableProgressCircle(overlayProgressRight, syncRunning);
|
||||
}
|
||||
|
||||
private void enableProgressCircle(final ProgressBar view, final boolean enabled) {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
setSupportProgressBarIndeterminateVisibility(syncRunning);
|
||||
if (enabled) {
|
||||
view.setProgress(0);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.setProgress(100);
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public abstract void triggerRefresh(int page);
|
||||
|
||||
@Override
|
||||
|
@ -592,6 +607,10 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
final Story story = readingAdapter.getStory(pager.getCurrentItem());
|
||||
if (story != null) {
|
||||
new AsyncTask<Void, Void, StoryTextResponse>() {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
enableProgressCircle(overlayProgressLeft, true);
|
||||
}
|
||||
@Override
|
||||
protected StoryTextResponse doInBackground(Void... arg) {
|
||||
return apiManager.getStoryText(story.feedId, story.id);
|
||||
|
@ -600,6 +619,7 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
|
|||
protected void onPostExecute(StoryTextResponse result) {
|
||||
ReadingItemFragment item = getReadingFragment();
|
||||
if (item != null) item.setCustomWebview(result.originalText);
|
||||
enableProgressCircle(overlayProgressLeft, false);
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue