Merge branch 'update_compose_while_posting' of https://github.com/theZacAttacks/Tusky into theZacAttacks-update_compose_while_posting

main
Vavassor 8 years ago
commit 03c0994879
  1. 13
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
  2. 22
      app/src/main/res/drawable/compose_button_colors.xml
  3. 69
      app/src/main/res/layout/activity_compose.xml

@ -69,6 +69,7 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -120,6 +121,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
private Button floatingBtn;
private ImageButton pickBtn;
private Button nsfwBtn;
private ProgressBar postProgress;
private static class QueuedMedia {
enum Type {
@ -339,11 +341,17 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
floatingBtn = (Button) findViewById(R.id.floating_btn);
pickBtn = (ImageButton) findViewById(R.id.compose_photo_pick);
nsfwBtn = (Button) findViewById(R.id.action_toggle_nsfw);
ImageButton visibilityBtn = (ImageButton) findViewById(R.id.action_toggle_visibility);
final ImageButton visibilityBtn = (ImageButton) findViewById(R.id.action_toggle_visibility);
floatingBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pickBtn.setClickable(false);
nsfwBtn.setClickable(false);
visibilityBtn.setClickable(false);
floatingBtn.setEnabled(false);
postProgress.setVisibility(View.VISIBLE);
sendStatus();
}
});
@ -393,6 +401,8 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
startingHideText = false;
}
postProgress = (ProgressBar) findViewById(R.id.postProgress);
postProgress.setVisibility(View.INVISIBLE);
updateNsfwButtonColor();
String[] mentionedUsernames = null;
@ -810,6 +820,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
}
private void onSendFailure() {
postProgress.setVisibility(View.INVISIBLE);
textEditor.setError(getString(R.string.error_generic));
statusAlreadyInFlight = false;
}

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true">
<shape>
<corners
android:radius="3dp"/>
<solid
android:color="@color/md_blue_600"/>
</shape>
</item>
<item android:state_enabled="false">
<shape>
<corners
android:radius="3dp"/>
<solid
android:color="@color/md_blue_grey_300"/>
</shape>
</item>
</selector>

@ -18,32 +18,6 @@
android:background="@android:color/transparent"
android:elevation="4dp" />
<LinearLayout
android:id="@+id/compose_content_warning_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="8dp">
<EditText
android:id="@+id/field_content_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:ems="10"
android:maxLines="1"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:hint="@string/hint_content_warning"
android:inputType="text|textCapSentences" />
<View
android:layout_marginTop="8dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/compose_edit_area"
android:layout_width="match_parent"
@ -57,9 +31,10 @@
* anonymous class to support image/GIF picking from the soft keyboard.-->
<HorizontalScrollView
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:id="@+id/compose_media_preview_bar"
android:layout_width="wrap_content"
@ -71,8 +46,41 @@
</LinearLayout>
</HorizontalScrollView>
<ProgressBar
android:id="@+id/postProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<LinearLayout
android:id="@+id/compose_content_warning_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="8dp">
<EditText
android:id="@+id/field_content_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:ems="10"
android:maxLines="1"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:hint="@string/hint_content_warning"
android:inputType="text|textCapSentences" />
<View
android:layout_marginTop="8dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -124,8 +132,9 @@
<Button
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/compose_button_colors"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginLeft="10dp"
android:text="@string/action_send"
android:textColor="@android:color/white" />

Loading…
Cancel
Save