Merge branch 'Gargron-master'

This commit is contained in:
Vavassor 2017-03-10 13:16:36 -05:00
commit eed8168e8a
15 changed files with 286 additions and 197 deletions

View file

@ -40,4 +40,8 @@ dependencies {
transitive = true
}
compile 'com.github.chrisbanes:PhotoView:1.3.1'
compile 'com.mikepenz:google-material-typeface:3.0.1.0.original@aar'
compile 'com.github.arimorty:floatingsearchview:2.0.3'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}

View file

@ -41,7 +41,6 @@ import android.provider.OpenableColumns;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v13.view.inputmethod.EditorInfoCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat;
@ -57,14 +56,15 @@ import android.text.Spanned;
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.webkit.MimeTypeMap;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
@ -72,6 +72,7 @@ import android.widget.TextView;
import com.keylesspalace.tusky.entity.Media;
import com.keylesspalace.tusky.entity.Status;
import com.squareup.picasso.Picasso;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
@ -100,8 +101,6 @@ public class ComposeActivity extends BaseActivity {
private static final int MEDIA_SIZE_UNKNOWN = -1;
private String inReplyToId;
private String domain;
private String accessToken;
private EditText textEditor;
private LinearLayout mediaPreviewBar;
private ArrayList<QueuedMedia> mediaQueued;
@ -117,6 +116,10 @@ public class ComposeActivity extends BaseActivity {
private ProgressDialog finishingUploadDialog;
private EditText contentWarningEditor;
private boolean mediaPickEnabled;
private ImageButton pickBtn;
private Button nsfwBtn;
private ImageButton visibilityBtn;
private Button floatingBtn;
private static class QueuedMedia {
enum Type {
@ -325,6 +328,7 @@ public class ComposeActivity extends BaseActivity {
actionBar.setTitle(null);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_close_24dp);
}
SharedPreferences preferences = getSharedPreferences(
@ -332,13 +336,35 @@ public class ComposeActivity extends BaseActivity {
mediaPickEnabled = true;
FloatingActionButton floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn);
floatingBtn = (Button) findViewById(R.id.floating_btn);
pickBtn = (ImageButton) findViewById(R.id.compose_photo_pick);
nsfwBtn = (Button) findViewById(R.id.action_toggle_nsfw);
visibilityBtn = (ImageButton) findViewById(R.id.action_toggle_visibility);
floatingBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendStatus();
}
});
pickBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMediaPick();
}
});
nsfwBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleNsfw();
}
});
visibilityBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showComposeOptions();
}
});
ArrayList<SavedQueuedMedia> savedMediaQueued = null;
if (savedInstanceState != null) {
@ -362,6 +388,12 @@ public class ComposeActivity extends BaseActivity {
statusHideText = false;
}
if (statusMarkSensitive) {
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.color_accent_dark));
} else {
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.image_button_dark));
}
Intent intent = getIntent();
String[] mentionedUsernames = null;
if (intent != null) {
@ -375,9 +407,6 @@ public class ComposeActivity extends BaseActivity {
mentionedUsernames = intent.getStringArrayExtra("mentioned_usernames");
}
domain = preferences.getString("domain", null);
accessToken = preferences.getString("accessToken", null);
textEditor = createEditText(null); // new String[] { "image/gif", "image/webp" }
if (savedInstanceState != null) {
textEditor.onRestoreInstanceState(savedInstanceState.getParcelable("textEditorState"));
@ -435,10 +464,19 @@ public class ComposeActivity extends BaseActivity {
}
}
private void toggleNsfw() {
statusMarkSensitive = !statusMarkSensitive;
if (statusMarkSensitive) {
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.color_accent_dark));
} else {
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.image_button_dark));
}
}
private void showComposeOptions() {
ComposeOptionsFragment fragment = ComposeOptionsFragment.newInstance(
statusVisibility, statusMarkSensitive, statusHideText,
showMarkSensitive, inReplyToId != null,
statusVisibility, statusHideText, inReplyToId != null,
new ComposeOptionsFragment.Listener() {
@Override
public int describeContents() {
@ -453,11 +491,6 @@ public class ComposeActivity extends BaseActivity {
statusVisibility = visibility;
}
@Override
public void onMarkSensitiveChanged(boolean markSensitive) {
statusMarkSensitive = markSensitive;
}
@Override
public void onContentWarningChanged(boolean hideText) {
showContentWarning(hideText);
@ -551,6 +584,7 @@ public class ComposeActivity extends BaseActivity {
editText.setLayoutParams(layoutParams);
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
editText.setEms(10);
editText.setBackgroundColor(0);
editText.setGravity(Gravity.START | Gravity.TOP);
editText.setHint(R.string.hint_compose);
return editText;
@ -758,23 +792,12 @@ public class ComposeActivity extends BaseActivity {
private void enableMediaPicking() {
mediaPickEnabled = true;
invalidateOptionsMenu();
pickBtn.setEnabled(true);
}
private void disableMediaPicking() {
mediaPickEnabled = false;
invalidateOptionsMenu();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (mediaPickEnabled) {
menu.findItem(R.id.compose_photo_pick).setEnabled(true);
} else {
menu.findItem(R.id.compose_photo_pick).setEnabled(false);
}
return super.onPrepareOptionsMenu(menu);
pickBtn.setEnabled(false);
}
private void addMediaToQueue(QueuedMedia.Type type, Bitmap preview, Uri uri, long mediaSize) {
@ -786,10 +809,15 @@ public class ComposeActivity extends BaseActivity {
int marginBottom = resources.getDimensionPixelSize(
R.dimen.compose_media_preview_margin_bottom);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(side, side);
layoutParams.setMargins(margin, margin, margin, marginBottom);
layoutParams.setMargins(margin, 0, margin, marginBottom);
view.setLayoutParams(layoutParams);
view.setImageBitmap(preview);
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
Picasso.with(this)
.load(uri)
.resize(side, side)
.centerCrop()
.into(view);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -1055,8 +1083,16 @@ public class ComposeActivity extends BaseActivity {
void showMarkSensitive(boolean show) {
showMarkSensitive = show;
if(!showMarkSensitive) {
statusMarkSensitive = false;
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.image_button_dark));
}
if(show) {
nsfwBtn.setVisibility(View.VISIBLE);
} else {
nsfwBtn.setVisibility(View.GONE);
}
}
@ -1069,12 +1105,6 @@ public class ComposeActivity extends BaseActivity {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.compose_toolbar, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
@ -1082,16 +1112,6 @@ public class ComposeActivity extends BaseActivity {
onBackPressed();
return true;
}
case R.id.compose_photo_pick: {
onMediaPick();
return true;
}
case R.id.compose_options: {
showComposeOptions();
return true;
}
}
return super.onOptionsItemSelected(item);

View file

@ -15,21 +15,18 @@ import android.widget.RadioGroup;
public class ComposeOptionsFragment extends BottomSheetDialogFragment {
public interface Listener extends Parcelable {
void onVisibilityChanged(String visibility);
void onMarkSensitiveChanged(boolean markSensitive);
void onContentWarningChanged(boolean hideText);
}
private Listener listener;
public static ComposeOptionsFragment newInstance(String visibility, boolean markSensitive,
boolean hideText, boolean showMarkSensitive, boolean isReply, Listener listener) {
public static ComposeOptionsFragment newInstance(String visibility,
boolean hideText, boolean isReply, Listener listener) {
Bundle arguments = new Bundle();
ComposeOptionsFragment fragment = new ComposeOptionsFragment();
arguments.putParcelable("listener", listener);
arguments.putString("visibility", visibility);
arguments.putBoolean("markSensitive", markSensitive);
arguments.putBoolean("hideText", hideText);
arguments.putBoolean("showMarkSensitive", showMarkSensitive);
arguments.putBoolean("isReply", isReply);
fragment.setArguments(arguments);
return fragment;
@ -44,9 +41,7 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
Bundle arguments = getArguments();
listener = arguments.getParcelable("listener");
String statusVisibility = arguments.getString("visibility");
boolean statusMarkSensitive = arguments.getBoolean("markSensitive");
boolean statusHideText = arguments.getBoolean("hideText");
boolean showMarkSensitive = arguments.getBoolean("showMarkSensitive");
boolean isReply = arguments.getBoolean("isReply");
RadioGroup radio = (RadioGroup) rootView.findViewById(R.id.radio_visibility);
@ -91,20 +86,6 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
publicButton.setEnabled(false);
}
CheckBox markSensitive = (CheckBox) rootView.findViewById(R.id.compose_mark_sensitive);
if (showMarkSensitive) {
markSensitive.setChecked(statusMarkSensitive);
markSensitive.setEnabled(true);
markSensitive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
listener.onMarkSensitiveChanged(isChecked);
}
});
} else {
markSensitive.setEnabled(false);
}
CheckBox hideText = (CheckBox) rootView.findViewById(R.id.compose_hide_text);
hideText.setChecked(statusHideText);
hideText.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

View file

@ -32,13 +32,17 @@ import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import com.arlib.floatingsearchview.FloatingSearchView;
import com.keylesspalace.tusky.entity.Account;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader;
@ -71,8 +75,8 @@ public class MainActivity extends BaseActivity {
// Fetch user info while we're doing other things.
fetchUserInfo();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);
FloatingActionButton floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn);
floatingBtn.setOnClickListener(new View.OnClickListener() {
@ -83,25 +87,13 @@ public class MainActivity extends BaseActivity {
}
});
final FloatingSearchView searchView = (FloatingSearchView) findViewById(R.id.floating_search_view);
headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withSelectionListEnabledForSingleProfile(false)
.withTranslucentStatusBar(true)
.withDividerBelowHeader(false)
.withCompactStyle(true)
.withOnAccountHeaderProfileImageListener(new AccountHeader.OnAccountHeaderProfileImageListener() {
@Override
public boolean onProfileImageClick(View view, IProfile profile, boolean current) {
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
intent.putExtra("id", loggedInAccountId);
startActivity(intent);
return false;
}
@Override
public boolean onProfileImageLongClick(View view, IProfile profile, boolean current) {
return false;
}
})
.build();
DrawerImageLoader.init(new AbstractDrawerImageLoader() {
@ -118,16 +110,17 @@ public class MainActivity extends BaseActivity {
drawer = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withTranslucentStatusBar(true)
//.withToolbar(toolbar)
.withAccountHeader(headerResult)
.withHasStableIds(true)
.withSelectedItem(-1)
.addDrawerItems(
new PrimaryDrawerItem().withIdentifier(1).withName(getString(R.string.action_view_favourites)).withSelectable(false),
new PrimaryDrawerItem().withIdentifier(2).withName(getString(R.string.action_view_blocks)).withSelectable(false),
new PrimaryDrawerItem().withIdentifier(3).withName(getString(R.string.action_view_preferences)).withSelectable(false),
new PrimaryDrawerItem().withIdentifier(4).withName(getString(R.string.action_logout)).withSelectable(false)
new PrimaryDrawerItem().withIdentifier(0).withName(R.string.action_view_profile).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_person),
new PrimaryDrawerItem().withIdentifier(1).withName(getString(R.string.action_view_favourites)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_star),
new PrimaryDrawerItem().withIdentifier(2).withName(getString(R.string.action_view_blocks)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_block),
new DividerDrawerItem(),
new SecondaryDrawerItem().withIdentifier(3).withName(getString(R.string.action_view_preferences)).withSelectable(false),
new SecondaryDrawerItem().withIdentifier(4).withName(getString(R.string.action_logout)).withSelectable(false)
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
@ -135,7 +128,11 @@ public class MainActivity extends BaseActivity {
if (drawerItem != null) {
long drawerItemIdentifier = drawerItem.getIdentifier();
if (drawerItemIdentifier == 1) {
if (drawerItemIdentifier == 0) {
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
intent.putExtra("id", loggedInAccountId);
startActivity(intent);
} else if (drawerItemIdentifier == 1) {
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class);
startActivity(intent);
} else if (drawerItemIdentifier == 2) {
@ -165,6 +162,8 @@ public class MainActivity extends BaseActivity {
})
.build();
searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout());
// Setup the tabs and timeline pager.
TimelinePagerAdapter adapter = new TimelinePagerAdapter(getSupportFragmentManager());
String[] pageTitles = {
@ -236,39 +235,40 @@ public class MainActivity extends BaseActivity {
final String domain = preferences.getString("domain", null);
String id = preferences.getString("loggedInAccountId", null);
String username = preferences.getString("loggedInAccountUsername", null);
//if (id != null && username != null) {
// loggedInAccountId = id;
// loggedInAccountUsername = username;
//} else {
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
@Override
public void onResponse(Call<Account> call, retrofit2.Response<Account> response) {
Account me = response.body();
ImageView background = headerResult.getHeaderBackgroundView();
Picasso.with(MainActivity.this)
.load(me.header)
.placeholder(R.drawable.account_header_missing)
.resize(background.getWidth(), background.getHeight())
.centerCrop()
.into(background);
if (id != null && username != null) {
loggedInAccountId = id;
loggedInAccountUsername = username;
}
headerResult.addProfiles(
new ProfileDrawerItem()
.withName(me.displayName)
.withEmail(String.format("%s@%s", me.username, domain))
.withIcon(me.avatar)
);
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
@Override
public void onResponse(Call<Account> call, retrofit2.Response<Account> response) {
Account me = response.body();
ImageView background = headerResult.getHeaderBackgroundView();
//onFetchUserInfoSuccess(response.body().id, response.body().username);
}
Picasso.with(MainActivity.this)
.load(me.header)
.placeholder(R.drawable.account_header_missing)
.resize(background.getWidth(), background.getHeight())
.centerCrop()
.into(background);
@Override
public void onFailure(Call<Account> call, Throwable t) {
onFetchUserInfoFailure((Exception) t);
}
});
//}
headerResult.addProfiles(
new ProfileDrawerItem()
.withName(me.displayName)
.withEmail(String.format("%s@%s", me.username, domain))
.withIcon(me.avatar)
);
//onFetchUserInfoSuccess(response.body().id, response.body().username);
}
@Override
public void onFailure(Call<Account> call, Throwable t) {
onFetchUserInfoFailure((Exception) t);
}
});
}
private void onFetchUserInfoSuccess(String id, String username) {

View file

@ -233,12 +233,13 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
previews[i].setVisibility(View.VISIBLE);
Picasso.with(context)
.load(previewUrl)
.placeholder(mediaPreviewUnloadedId)
.into(previews[i]);
.load(previewUrl)
.placeholder(mediaPreviewUnloadedId)
.into(previews[i]);
final String url = attachments[i].url;
final Status.MediaAttachment.Type type = attachments[i].type;
previews[i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -28,6 +28,9 @@ import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
public class ViewMediaFragment extends Fragment {
private PhotoViewAttacher attacher;
public static ViewMediaFragment newInstance(String url) {
Bundle arguments = new Bundle();
ViewMediaFragment fragment = new ViewMediaFragment();
@ -45,7 +48,7 @@ public class ViewMediaFragment extends Fragment {
String url = arguments.getString("url");
PhotoView photoView = (PhotoView) rootView.findViewById(R.id.view_media_image);
final PhotoViewAttacher attacher = new PhotoViewAttacher(photoView);
attacher = new PhotoViewAttacher(photoView);
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
@ -76,6 +79,12 @@ public class ViewMediaFragment extends Fragment {
return rootView;
}
@Override
public void onDestroyView() {
attacher.cleanup();
super.onDestroyView();
}
private void dismiss() {
getFragmentManager().popBackStack();
}

View file

@ -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="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>

View file

@ -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="#FF000000"
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>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_compose"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -9,85 +10,129 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:elevation="4dp"
android:layout_marginBottom="16dp"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:background="?attr/toolbar_background_color" />
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark" />
<LinearLayout
android:id="@+id/compose_content_warning_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/compose_content_warning_bar"
android:paddingTop="0dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_marginBottom="4dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/field_content_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/hint_content_warning"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
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"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingBottom="4dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="16dp"
android:id="@+id/compose_edit_area">
android:paddingRight="16dp">
<!--An special EditText is created at runtime here, because it has to be a modified
* anonymous class to support image/GIF picking from the soft keyboard.-->
<LinearLayout
<HorizontalScrollView
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/compose_media_preview_bar"
android:layout_alignParentBottom="true">
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/compose_media_preview_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="4dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingBottom="16dp"
android:layout_height="wrap_content">
android:paddingRight="16dp"
android:paddingTop="4dp">
<ImageButton
android:id="@+id/compose_photo_pick"
style="?attr/image_button_style"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_attach_file_24dp" />
<ImageButton
android:id="@+id/action_toggle_visibility"
style="?attr/image_button_style"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_public_24dp" />
<Button
android:id="@+id/action_toggle_nsfw"
style="?attr/image_button_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:visibility="gone"
android:textColor="@color/image_button_dark"
android:text="@string/toggle_nsfw" />
<android.support.v4.widget.Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/characters_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:text="500" />
android:text="500"
android:textColor="?android:textColorPrimary" />
<Button
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/action_send" />
</LinearLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_send_24dp"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -16,14 +16,14 @@
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
<!--<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="?attr/toolbar_background_color" />
android:background="?attr/toolbar_background_color" />-->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
@ -34,9 +34,11 @@
android:id="@+id/tab_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:colorBackground"
android:paddingTop="?attr/actionBarSize"
app:tabTextAppearance="@style/TabLayoutTextStyle"
app:tabBackground="?android:colorBackground"
app:tabPaddingStart="1dp"
app:tabPaddingTop="4dp"
app:tabPaddingEnd="1dp">
<android.support.design.widget.TabItem
@ -59,6 +61,19 @@
</android.support.v4.view.ViewPager>
</LinearLayout>
<com.arlib.floatingsearchview.FloatingSearchView
android:id="@+id/floating_search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:floatingSearch_searchBarMarginLeft="6dp"
app:floatingSearch_searchBarMarginTop="4dp"
app:floatingSearch_searchBarMarginRight="6dp"
app:floatingSearch_searchHint="@string/search"
app:floatingSearch_suggestionsListAnimDuration="250"
app:floatingSearch_showSearchKey="false"
app:floatingSearch_leftActionMode="showHamburger"
app:floatingSearch_close_search_on_keyboard_dismiss="true"/>
<FrameLayout
android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent"
@ -68,7 +83,9 @@
<android.support.design.widget.FloatingActionButton
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
app:layout_anchor="@id/pager"
app:layout_anchorGravity="bottom|end"
android:clickable="true"
android:layout_margin="16dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_create_24dp"/>

View file

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:padding="16dp"
android:layout_height="match_parent">
<RadioGroup
@ -35,13 +36,6 @@
</RadioGroup>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/compose_options_margin"
android:id="@+id/compose_mark_sensitive"
android:text="@string/action_mark_sensitive" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="match_parent"

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/compose_photo_pick"
android:title="@string/action_photo_pick"
android:icon="@drawable/ic_attach_file_24dp"
app:showAsAction="always"/>
<item android:id="@+id/compose_options"
android:title="@string/action_compose_options"
android:icon="@drawable/ic_visibility_24dp"
app:showAsAction="always"/>
</menu>

View file

@ -10,8 +10,8 @@
<dimen name="status_media_preview_height">96dp</dimen>
<dimen name="footer_text_padding">8dp</dimen>
<dimen name="compose_media_preview_margin">8dp</dimen>
<dimen name="compose_media_preview_margin_bottom">16dp</dimen>
<dimen name="compose_media_preview_side">48dp</dimen>
<dimen name="compose_media_preview_margin_bottom">0dp</dimen>
<dimen name="compose_media_preview_side">120dp</dimen>
<dimen name="compose_options_margin">8dp</dimen>
<dimen name="notification_icon_vertical_padding">8dp</dimen>
<dimen name="notification_icon_left_padding">40dp</dimen>

View file

@ -134,9 +134,9 @@
<string name="dialog_title_finishing_media_upload">Finishing Media Upload</string>
<string name="dialog_message_uploading_media">Uploading…</string>
<string name="visibility_public">Show on public timeline</string>
<string name="visibility_unlisted">Do not display on public timeline</string>
<string name="visibility_private">Mark as private</string>
<string name="visibility_public">Everyone can see</string>
<string name="visibility_unlisted">Everyone can see, but not on public timelines</string>
<string name="visibility_private">Only followers and mentions can see</string>
<string name="notification_service_description">Allows Tusky to check for Mastodon notifications.</string>
<string name="notification_service_several_mentions">%d new mentions</string>
@ -162,5 +162,7 @@
<string name="action_unmute">Unmute</string>
<string name="error_unmuting">That user wasn\'t unmuted.</string>
<string name="error_muting">That user wasn\'t muted.</string>
<string name="search">Search accounts...</string>
<string name="toggle_nsfw">NSFW</string>
</resources>

View file

@ -49,22 +49,32 @@
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Dark</item>
<item name="compose_media_button_tint">@color/compose_media_button_dark</item>
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_dark</item>
<item name="compose_mention_color">@color/compose_mention_dark</item>
<item name="compose_mention_color">@color/color_accent_dark</item>
<item name="compose_content_warning_bar_background">@drawable/border_background_dark</item>
<item name="notification_content">@color/notification_content_faded_dark</item>
<item name="notification_icon_tint">@color/notification_icon_tint_dark</item>
<item name="report_status_background_color">@color/report_status_background_dark</item>
<item name="report_status_divider_drawable">@drawable/report_status_divider_dark</item>
<item name="material_drawer_background">@color/color_primary_dark</item>
<item name="material_drawer_background">@color/window_background_dark</item>
<item name="material_drawer_primary_text">@color/text_color_primary_dark</item>
<item name="material_drawer_primary_icon">@color/toolbar_icon_dark</item>
<item name="material_drawer_secondary_text">@color/text_color_secondary_dark</item>
<item name="material_drawer_hint_text">@color/text_color_tertiary_dark</item>
<item name="material_drawer_divider">@color/color_primary_dark_dark</item>
<item name="material_drawer_selected">@color/window_background_dark</item>
<item name="material_drawer_selected">@color/color_primary_dark</item>
<item name="material_drawer_selected_text">@color/text_color_primary_dark</item>
<item name="material_drawer_header_selection_text">@color/text_color_primary_dark</item>
<item name="floatingSearch_backgroundColor">@color/toolbar_background_dark</item>
<item name="floatingSearch_viewTextColor">@color/text_color_secondary_dark</item>
<item name="floatingSearch_hintTextColor">@color/text_color_tertiary_dark</item>
<item name="floatingSearch_dividerColor">@color/status_divider_dark</item>
<item name="floatingSearch_clearBtnColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_leftActionColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_menuItemIconColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_suggestionRightIconColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_actionMenuOverflowColor">@color/toolbar_icon_dark</item>-->
</style>
<style name="AppTheme.ImageButton.Dark" parent="@style/Widget.AppCompat.Button.Borderless.Colored">