Placeholder styling of overlay buttons.

This commit is contained in:
ojiikun 2013-08-13 06:50:17 +00:00
parent ca31679c4d
commit d84b119b67
9 changed files with 51 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="false" android:drawable="@drawable/overlay_left_arrow_disabled" />
<item android:state_enabled="true" android:drawable="@drawable/overlay_left_arrow_enabled" />
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="false" android:drawable="@drawable/overlay_right_check" />
<item android:state_enabled="true" android:drawable="@drawable/overlay_right_arrow_enabled" />
</selector>

View file

@ -14,26 +14,37 @@
android:layout_height="1dip"
android:layout_alignParentTop="true" />
<Button
android:id="@+id/reading_overlay_next"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:text="next"
android:onClick="overlayNext" />
android:layout_alignParentRight="true" >
<Button
android:id="@+id/reading_overlay_prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/reading_overlay_next"
android:layout_marginBottom="10dp"
android:layout_marginRight="15dp"
android:text="prev"
android:onClick="overlayPrev" />
<Button
android:id="@+id/reading_overlay_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textSize="12sp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:drawableLeft="@drawable/selector_overlay_left_icon"
android:onClick="overlayLeft" />
<Button
android:id="@+id/reading_overlay_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/overlay_next"
android:textColor="@color/half_darkgray"
android:textSize="12sp"
android:padding="6dp"
android:drawableRight="@drawable/selector_overlay_right_icon"
android:onClick="overlayRight" />
</LinearLayout>
</RelativeLayout>

View file

@ -58,6 +58,9 @@
<string name="save_this">SAVE THIS STORY</string>
<string name="share_this">SHARE THIS STORY</string>
<string name="overlay_next">NEXT</string>
<string name="overlay_done">DONE</string>
<string name="reply_to">Reply to \"%s\"</string>
<string name="alert_dialog_ok">Okay</string>

View file

@ -56,7 +56,7 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
protected int currentState;
protected ViewPager pager;
protected Button overlayPrev, overlayNext;
protected Button overlayLeft, overlayRight;
protected FragmentManager fragmentManager;
protected ReadingAdapter readingAdapter;
protected ContentResolver contentResolver;
@ -76,8 +76,8 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
super.onCreate(savedInstanceBundle);
setContentView(R.layout.activity_reading);
this.overlayNext = (Button) findViewById(R.id.reading_overlay_next);
this.overlayPrev = (Button) findViewById(R.id.reading_overlay_prev);
this.overlayLeft = (Button) findViewById(R.id.reading_overlay_left);
this.overlayRight = (Button) findViewById(R.id.reading_overlay_right);
fragmentManager = getSupportFragmentManager();
@ -206,14 +206,15 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
}
private void setOverlayAlpha(float a) {
UIUtils.setViewAlpha(this.overlayPrev, a);
UIUtils.setViewAlpha(this.overlayNext, a);
UIUtils.setViewAlpha(this.overlayLeft, a);
UIUtils.setViewAlpha(this.overlayRight, a);
}
private void enableOverlays() {
int page = this.pager.getCurrentItem();
this.overlayPrev.setEnabled(page > 0);
this.overlayNext.setEnabled(page < (this.readingAdapter.getCount()-1));
this.overlayLeft.setEnabled(page > 0);
this.overlayRight.setEnabled(page < (this.readingAdapter.getCount()-1));
this.overlayRight.setText((page < (this.readingAdapter.getCount()-1)) ? R.string.overlay_next : R.string.overlay_done);
}
@Override
@ -301,11 +302,11 @@ public abstract class Reading extends NbFragmentActivity implements OnPageChange
public void onStopTrackingTouch(SeekBar seekBar) {
}
public void overlayNext(View v) {
public void overlayRight(View v) {
pager.setCurrentItem(pager.getCurrentItem()+1, true);
}
public void overlayPrev(View v) {
public void overlayLeft(View v) {
pager.setCurrentItem(pager.getCurrentItem()-1, true);
}