Browse Source

fix issue #56, update gradle plugin

pull/61/merge
Thodoris1999 6 years ago
parent
commit
b487f5aa35
  1. 56
      app/src/main/java/gr/thmmy/mthmmy/editorview/AutoFitGridLayout.java
  2. 149
      app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java
  3. 56
      app/src/main/java/gr/thmmy/mthmmy/editorview/FormatButtonsAdapter.java
  4. 128
      app/src/main/res/layout/editor_view.xml
  5. 8
      app/src/main/res/layout/format_button_grid_cell.xml
  6. 4
      app/src/main/res/values/attrs.xml
  7. 2
      app/src/main/res/values/dimens.xml
  8. 2
      build.gradle
  9. 4
      gradle/wrapper/gradle-wrapper.properties

56
app/src/main/java/gr/thmmy/mthmmy/editorview/AutoFitGridLayout.java

@ -1,56 +0,0 @@
package gr.thmmy.mthmmy.editorview;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.GridLayout;
import gr.thmmy.mthmmy.R;
public class AutoFitGridLayout extends GridLayout {
private int columnWidth;
private int defaultColumnCount;
public AutoFitGridLayout(Context context) {
super(context);
init(context, null, 0);
}
public AutoFitGridLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs, 0);
}
public AutoFitGridLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs, defStyleAttr);
}
public void init(Context context, AttributeSet attrs, int defStyleAttr) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AutoFitGridLayout, 0, defStyleAttr);
try {
columnWidth = a.getDimensionPixelSize(R.styleable.AutoFitGridLayout_columnWidth, 0);
int[] set = {android.R.attr.columnCount};
a = context.obtainStyledAttributes(attrs, set, 0, defStyleAttr);
defaultColumnCount = a.getInt(0, 6);
} finally {
a.recycle();
}
setColumnCount(1);
}
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
super.onMeasure(widthSpec, heightSpec);
int width = MeasureSpec.getSize(widthSpec);
if (columnWidth > 0 && width > 0) {
int totalSpace = width - getPaddingRight() - getPaddingLeft();
int columnCount = Math.max(1, totalSpace / columnWidth);
setColumnCount(columnCount);
} else {
setColumnCount(defaultColumnCount);
}
}
}

149
app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java

@ -10,9 +10,12 @@ import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout; import android.support.design.widget.TextInputLayout;
import android.support.v7.widget.AppCompatImageButton; import android.support.v7.widget.AppCompatImageButton;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
@ -80,63 +83,58 @@ public class EditorView extends LinearLayout {
return false; return false;
}); });
emojiButton.setOnClickListener(view -> { colors.append(R.id.black, "black");
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); colors.append(R.id.red, "red");
assert imm != null; colors.append(R.id.yellow, "yellow");
if (emojiKeyboardOwner.isEmojiKeyboardVisible()) { colors.append(R.id.pink, "pink");
editText.requestFocus(); colors.append(R.id.green, "green");
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); colors.append(R.id.orange, "orange");
emojiButton.setImageResource(R.drawable.ic_tag_faces_24dp); colors.append(R.id.purple, "purple");
} else { colors.append(R.id.blue, "blue");
imm.hideSoftInputFromWindow(getWindowToken(), 0); colors.append(R.id.beige, "beige");
view.clearFocus(); colors.append(R.id.brown, "brown");
emojiButton.setImageResource(R.drawable.ic_keyboard_24dp); colors.append(R.id.teal, "teal");
} colors.append(R.id.navy, "navy");
emojiKeyboardOwner.setEmojiKeyboardVisible(!emojiKeyboardOwner.isEmojiKeyboardVisible()); colors.append(R.id.maroon, "maroon");
}); colors.append(R.id.lime_green, "limegreen");
submitButton = findViewById(R.id.submit_button); RecyclerView formatButtonsRecyclerview = findViewById(R.id.buttons_recyclerview);
findViewById(R.id.bold_button).setOnClickListener(view -> { DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
float itemWidth = getResources().getDimension(R.dimen.editor_format_button_size) +
getResources().getDimension(R.dimen.editor_format_button_margin_between);
int columns = (int) Math.floor(displayMetrics.widthPixels / itemWidth);
formatButtonsRecyclerview.setLayoutManager(new GridLayoutManager(context, columns));
formatButtonsRecyclerview.setAdapter(new FormatButtonsAdapter((view, drawableId) -> {
switch (drawableId) {
case R.drawable.ic_format_bold: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[b]"); getText().insert(editText.getSelectionStart(), "[b]");
getText().insert(editText.getSelectionEnd(), "[/b]"); getText().insert(editText.getSelectionEnd(), "[/b]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4);
}); break;
findViewById(R.id.italic_button).setOnClickListener(view -> { }
case R.drawable.ic_format_italic: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[i]"); getText().insert(editText.getSelectionStart(), "[i]");
getText().insert(editText.getSelectionEnd(), "[/i]"); getText().insert(editText.getSelectionEnd(), "[/i]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4);
}); break;
findViewById(R.id.underline_button).setOnClickListener(view -> { }
case R.drawable.ic_format_underlined: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[u]"); getText().insert(editText.getSelectionStart(), "[u]");
getText().insert(editText.getSelectionEnd(), "[/u]"); getText().insert(editText.getSelectionEnd(), "[/u]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4);
}); break;
findViewById(R.id.strikethrough_button).setOnClickListener(view -> { }
case R.drawable.ic_strikethrough_s: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[s]"); getText().insert(editText.getSelectionStart(), "[s]");
getText().insert(editText.getSelectionEnd(), "[/s]"); getText().insert(editText.getSelectionEnd(), "[/s]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 4);
}); break;
}
colors.append(R.id.black, "black"); case R.drawable.ic_format_color_text: {
colors.append(R.id.red, "red");
colors.append(R.id.yellow, "yellow");
colors.append(R.id.pink, "pink");
colors.append(R.id.green, "green");
colors.append(R.id.orange, "orange");
colors.append(R.id.purple, "purple");
colors.append(R.id.blue, "blue");
colors.append(R.id.beige, "beige");
colors.append(R.id.brown, "brown");
colors.append(R.id.teal, "teal");
colors.append(R.id.navy, "navy");
colors.append(R.id.maroon, "maroon");
colors.append(R.id.lime_green, "limegreen");
findViewById(R.id.text_color_button).setOnClickListener(view -> {
PopupWindow popupWindow = new PopupWindow(view.getContext()); PopupWindow popupWindow = new PopupWindow(view.getContext());
popupWindow.setHeight(LayoutParams.WRAP_CONTENT); popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT); popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
@ -155,44 +153,51 @@ public class EditorView extends LinearLayout {
}); });
} }
popupWindow.showAsDropDown(view); popupWindow.showAsDropDown(view);
}); break;
findViewById(R.id.text_size_button).setOnClickListener(view -> { }
case R.drawable.ic_format_size: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[size=10pt]"); getText().insert(editText.getSelectionStart(), "[size=10pt]");
getText().insert(editText.getSelectionEnd(), "[/size]"); getText().insert(editText.getSelectionEnd(), "[/size]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7);
}); break;
findViewById(R.id.font_button).setOnClickListener(view -> { }
case R.drawable.ic_text_format: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[font=Verdana]"); getText().insert(editText.getSelectionStart(), "[font=Verdana]");
getText().insert(editText.getSelectionEnd(), "[/font]"); getText().insert(editText.getSelectionEnd(), "[/font]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7);
}); break;
findViewById(R.id.unordered_list_button).setOnClickListener(view -> { }
case R.drawable.ic_format_list_bulleted: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[list]\n[li]"); getText().insert(editText.getSelectionStart(), "[list]\n[li]");
getText().insert(editText.getSelectionEnd(), "[/li]\n[li][/li]\n[/list]"); getText().insert(editText.getSelectionEnd(), "[/li]\n[li][/li]\n[/list]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() - 13 : editText.getSelectionStart() - 23); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() - 13 : editText.getSelectionStart() - 23);
}); break;
findViewById(R.id.align_left_button).setOnClickListener(view -> { }
case R.drawable.ic_format_align_left: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[left]"); getText().insert(editText.getSelectionStart(), "[left]");
getText().insert(editText.getSelectionEnd(), "[/left]"); getText().insert(editText.getSelectionEnd(), "[/left]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7);
}); break;
findViewById(R.id.align_center_button).setOnClickListener(view -> { }
case R.drawable.ic_format_align_center: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[center]"); getText().insert(editText.getSelectionStart(), "[center]");
getText().insert(editText.getSelectionEnd(), "[/center]"); getText().insert(editText.getSelectionEnd(), "[/center]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 9); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 9);
}); break;
findViewById(R.id.align_right_button).setOnClickListener(view -> { }
case R.drawable.ic_format_align_right: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[right]"); getText().insert(editText.getSelectionStart(), "[right]");
getText().insert(editText.getSelectionEnd(), "[/right]"); getText().insert(editText.getSelectionEnd(), "[/right]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 8); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 8);
}); break;
findViewById(R.id.link_button).setOnClickListener(view -> { }
case R.drawable.ic_insert_link: {
LinearLayout dialogBody = (LinearLayout) LayoutInflater.from(context) LinearLayout dialogBody = (LinearLayout) LayoutInflater.from(context)
.inflate(R.layout.dialog_create_link, null); .inflate(R.layout.dialog_create_link, null);
TextInputLayout linkUrl = dialogBody.findViewById(R.id.link_url_input); TextInputLayout linkUrl = dialogBody.findViewById(R.id.link_url_input);
@ -225,25 +230,49 @@ public class EditorView extends LinearLayout {
}) })
.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss()) .setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss())
.show(); .show();
}); break;
findViewById(R.id.quote_button).setOnClickListener(view -> { }
case R.drawable.ic_format_quote: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[quote]"); getText().insert(editText.getSelectionStart(), "[quote]");
getText().insert(editText.getSelectionEnd(), "[/quote]"); getText().insert(editText.getSelectionEnd(), "[/quote]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 8); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 8);
}); break;
findViewById(R.id.code_button).setOnClickListener(view -> { }
case R.drawable.ic_code: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[code]"); getText().insert(editText.getSelectionStart(), "[code]");
getText().insert(editText.getSelectionEnd(), "[/code]"); getText().insert(editText.getSelectionEnd(), "[/code]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 7);
}); break;
findViewById(R.id.math_button).setOnClickListener(view -> { }
case R.drawable.ic_functions: {
boolean hadTextSelection = editText.hasSelection(); boolean hadTextSelection = editText.hasSelection();
getText().insert(editText.getSelectionStart(), "[tex]"); getText().insert(editText.getSelectionStart(), "[tex]");
getText().insert(editText.getSelectionEnd(), "[/tex]"); getText().insert(editText.getSelectionEnd(), "[/tex]");
editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 6); editText.setSelection(hadTextSelection ? editText.getSelectionEnd() : editText.getSelectionStart() - 6);
break;
}
default: throw new IllegalArgumentException("Unknown format button click");
}
}));
emojiButton.setOnClickListener(view -> {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
assert imm != null;
if (emojiKeyboardOwner.isEmojiKeyboardVisible()) {
editText.requestFocus();
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
emojiButton.setImageResource(R.drawable.ic_tag_faces_24dp);
} else {
imm.hideSoftInputFromWindow(getWindowToken(), 0);
view.clearFocus();
emojiButton.setImageResource(R.drawable.ic_keyboard_24dp);
}
emojiKeyboardOwner.setEmojiKeyboardVisible(!emojiKeyboardOwner.isEmojiKeyboardVisible());
}); });
submitButton = findViewById(R.id.submit_button);
} }
public TextInputEditText getEditText() { public TextInputEditText getEditText() {

56
app/src/main/java/gr/thmmy/mthmmy/editorview/FormatButtonsAdapter.java

@ -0,0 +1,56 @@
package gr.thmmy.mthmmy.editorview;
import android.support.annotation.NonNull;
import android.support.v7.widget.AppCompatImageButton;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import gr.thmmy.mthmmy.R;
public class FormatButtonsAdapter extends RecyclerView.Adapter<FormatButtonsAdapter.FormatButtonViewHolder> {
private OnFormatButtonClickListener listener;
public static final int[] FORMAT_BUTTON_IDS = {R.drawable.ic_format_bold, R.drawable.ic_format_italic,
R.drawable.ic_format_underlined, R.drawable.ic_strikethrough_s, R.drawable.ic_format_color_text,
R.drawable.ic_format_size, R.drawable.ic_text_format, R.drawable.ic_format_list_bulleted,
R.drawable.ic_format_align_left, R.drawable.ic_format_align_center, R.drawable.ic_format_align_right,
R.drawable.ic_insert_link, R.drawable.ic_format_quote, R.drawable.ic_code, R.drawable.ic_functions};
public FormatButtonsAdapter(OnFormatButtonClickListener listener) {
this.listener = listener;
}
@NonNull
@Override
public FormatButtonViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
AppCompatImageButton formatButton = (AppCompatImageButton) LayoutInflater.from(parent.getContext())
.inflate(R.layout.format_button_grid_cell, parent, false);
return new FormatButtonViewHolder(formatButton);
}
@Override
public void onBindViewHolder(@NonNull FormatButtonViewHolder holder, int position) {
holder.formatButton.setImageResource(FORMAT_BUTTON_IDS[position]);
holder.formatButton.setOnClickListener(v ->
listener.onFormatButtonClick(v, FORMAT_BUTTON_IDS[holder.getAdapterPosition()]));
}
@Override
public int getItemCount() {
return FORMAT_BUTTON_IDS.length;
}
static class FormatButtonViewHolder extends RecyclerView.ViewHolder {
AppCompatImageButton formatButton;
FormatButtonViewHolder(AppCompatImageButton formatButton) {
super(formatButton);
this.formatButton = formatButton;
}
}
public interface OnFormatButtonClickListener {
void onFormatButtonClick(View view, int drawableId);
}
}

128
app/src/main/res/layout/editor_view.xml

@ -4,132 +4,10 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<gr.thmmy.mthmmy.editorview.AutoFitGridLayout <android.support.v7.widget.RecyclerView
android:id="@+id/buttons_recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"/>
android:orientation="horizontal"
app:columnWidth="28dp">
<!--bold, italic, etc buttons-->
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/bold_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_bold"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/italic_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_italic"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/underline_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_underlined"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/strikethrough_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_strikethrough_s"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/text_color_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_color_text"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/text_size_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_size"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/font_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_text_format"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/unordered_list_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_list_bulleted"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/align_left_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_align_left"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/align_center_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_align_center"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/align_right_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_align_right"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/link_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_insert_link"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/quote_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_format_quote_unchecked_24dp"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/code_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_code"
android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/math_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
app:srcCompat="@drawable/ic_functions"
android:background="?android:selectableItemBackground"/>
</gr.thmmy.mthmmy.editorview.AutoFitGridLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

8
app/src/main/res/layout/format_button_grid_cell.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.AppCompatImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bold_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/editor_format_button_margin_between"
android:background="?android:selectableItemBackground" />

4
app/src/main/res/values/attrs.xml

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<declare-styleable name="AutoFitGridLayout" >
<attr name="columnWidth" format="dimension" />
</declare-styleable>
<declare-styleable name="EditorView" > <declare-styleable name="EditorView" >
<attr name="hint" format="string" /> <attr name="hint" format="string" />
</declare-styleable> </declare-styleable>

2
app/src/main/res/values/dimens.xml

@ -10,5 +10,5 @@
<dimen name="medium_text">16sp</dimen> <dimen name="medium_text">16sp</dimen>
<dimen name="big_text">24sp</dimen> <dimen name="big_text">24sp</dimen>
<dimen name="editor_format_button_size">24dp</dimen> <dimen name="editor_format_button_size">24dp</dimen>
<dimen name="editor_format_button_margin_between">4dp</dimen> <dimen name="editor_format_button_margin_between">6dp</dimen>
</resources> </resources>

2
build.gradle

@ -8,7 +8,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.0.1' classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4' classpath 'io.fabric.tools:gradle:1.25.4'
} }

4
gradle/wrapper/gradle-wrapper.properties

@ -1,6 +1,6 @@
#Sat Apr 07 11:11:36 EEST 2018 #Fri Sep 28 13:21:54 EEST 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

Loading…
Cancel
Save