Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added doodle option #328

Merged
merged 46 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b6868ce
Enhancement options in text to pdf
shiv07tiwari Jul 17, 2018
ac163f1
Changes
shiv07tiwari Jul 17, 2018
099bc4e
Changes
shiv07tiwari Jul 17, 2018
1ec9e96
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 17, 2018
65b0075
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 19, 2018
88cc997
Added About Screen
shiv07tiwari Jul 20, 2018
7f78105
Minor
shiv07tiwari Jul 20, 2018
185bfcf
Changed UI
shiv07tiwari Jul 20, 2018
b188e55
Fix
shiv07tiwari Jul 20, 2018
1dcab7e
Changes
shiv07tiwari Jul 20, 2018
fa2901d
Update
shiv07tiwari Jul 21, 2018
201f421
Added more filters
shiv07tiwari Jul 21, 2018
6943292
Image fix
shiv07tiwari Jul 21, 2018
a74e70c
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 21, 2018
655764c
View Files UI Fix
shiv07tiwari Jul 21, 2018
eedfe28
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 21, 2018
c87507e
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 22, 2018
b648907
improving code climate
Swati4star Jul 22, 2018
1451366
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 23, 2018
6c58892
Update
shiv07tiwari Jul 26, 2018
97fd8fd
Added undo option
shiv07tiwari Jul 27, 2018
7f88b74
Check fix
shiv07tiwari Jul 27, 2018
852c404
Variable change
shiv07tiwari Jul 27, 2018
e0c4097
Merge branch 'master' into master
shiv07tiwari Jul 27, 2018
a9fc70b
Update
shiv07tiwari Jul 28, 2018
759b22b
Update
shiv07tiwari Jul 28, 2018
93b391d
Search Fix
shiv07tiwari Jul 28, 2018
b8b6267
Fix
shiv07tiwari Jul 28, 2018
b55ee3f
Double click fix
shiv07tiwari Jul 28, 2018
96b7f2f
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 28, 2018
e23c0b0
Fix
shiv07tiwari Jul 28, 2018
b4c41f0
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 28, 2018
135ca8c
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 28, 2018
5ef51af
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 29, 2018
97fb29c
History date format
shiv07tiwari Jul 29, 2018
5ae651a
Fix
shiv07tiwari Jul 29, 2018
6304bdd
Fragment Transitions
shiv07tiwari Jul 29, 2018
7eb99b6
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Jul 29, 2018
79c7aaf
Fragment Transaction
shiv07tiwari Jul 29, 2018
afba8b5
minor
shiv07tiwari Jul 29, 2018
97f3ce8
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Aug 1, 2018
e1c9fd8
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Aug 2, 2018
2f98a9f
Add Doodle option
shiv07tiwari Aug 2, 2018
2e0d9fc
Merge branch 'master' of https://github.com/Swati4star/Images-to-PDF
shiv07tiwari Aug 2, 2018
90c4497
Fix
shiv07tiwari Aug 2, 2018
68d1c69
Fix
shiv07tiwari Aug 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions app/src/main/java/swati4star/createpdf/activity/ImageEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -62,6 +65,7 @@ public class ImageEditor extends AppCompatActivity implements OnFilterItemClicke
ImageButton mPreviousButton;
@BindView(R.id.resetCurrent)
Button resetCurrent;
SeekBar doodleSeekBar;

private Bitmap mBitmap;
private PhotoEditorView mPhotoEditorView;
Expand All @@ -70,6 +74,7 @@ public class ImageEditor extends AppCompatActivity implements OnFilterItemClicke
private boolean mIsLast = false;

private PhotoEditor mPhotoEditor;
Button mDoodleButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -91,10 +96,60 @@ protected void onCreate(Bundle savedInstanceState) {
mFilterItems = getFiltersList(this);
mImagepaths.addAll(mFilterUris);
initRecyclerView();
mDoodleButton = findViewById(R.id.doodleButton);
doodleSeekBar = findViewById(R.id.doodleSeekBar);
mPhotoEditor = new PhotoEditor.Builder(this, mPhotoEditorView)
.setPinchTextScalable(true)
.build();
mPhotoEditor.setBrushSize(30);
doodleSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mPhotoEditor.setBrushSize(progress);
}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
mPhotoEditor.setBrushDrawingMode(false);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
}

@OnClick(R.id.doodle_color_white)
void setColorWhite() {
doodleSeekBar.setBackgroundColor(getResources().getColor(R.color.mb_white));
mPhotoEditor.setBrushColor(getResources().getColor(R.color.mb_white));
}

@OnClick(R.id.doodle_color_black)
void setColorBlack() {
doodleSeekBar.setBackgroundColor(getResources().getColor(R.color.black_87));
mPhotoEditor.setBrushColor(getResources().getColor(R.color.black_87));
}

@OnClick(R.id.doodle_color_red)
void setColorRed() {
doodleSeekBar.setBackgroundColor(getResources().getColor(R.color.red));
mPhotoEditor.setBrushColor(getResources().getColor(R.color.red));
}

@OnClick(R.id.doodle_color_blue)
void setColorBlue() {
doodleSeekBar.setBackgroundColor(getResources().getColor(R.color.mb_blue));
mPhotoEditor.setBrushColor(getResources().getColor(R.color.mb_blue));
}

@OnClick(R.id.doodle_color_green)
void setColorGreen() {
doodleSeekBar.setBackgroundColor(getResources().getColor(R.color.mb_green));
mPhotoEditor.setBrushColor(getResources().getColor(R.color.mb_green));
}

@OnClick(R.id.nextimageButton)
void nextImg() {
//Proceed to next if Save Current has been clicked
Expand Down Expand Up @@ -134,6 +189,8 @@ void resetCurrent() {
mImagepaths.add(mCurrentImage, originalPath);
mBitmap = BitmapFactory.decodeFile(originalPath);
mPhotoEditorView.getSource().setImageBitmap(mBitmap);
mPhotoEditor.clearAllViews();
mPhotoEditor.undo();
}
}

Expand Down Expand Up @@ -330,6 +387,29 @@ private void cancelFilter() {

}

@OnClick(R.id.doodleButton)
public void doodleEffect() {

mPhotoEditor = new PhotoEditor.Builder(this, mPhotoEditorView)
.setPinchTextScalable(true)
.build();
LinearLayout colorLayout = findViewById(R.id.doodle_colors);
if (doodleSeekBar.getVisibility() == View.GONE && colorLayout.getVisibility() == View.GONE) {
mPhotoEditor.setBrushDrawingMode(true);
doodleSeekBar.setVisibility(View.VISIBLE);
mDoodleButton.setText(R.string.disable_doodle_effect);
mDoodleButton.setBackgroundColor(getResources().getColor(R.color.mb_white));
colorLayout.setVisibility(View.VISIBLE);
} else if (doodleSeekBar.getVisibility() == View.VISIBLE &&
colorLayout.getVisibility() == View.VISIBLE) {
mPhotoEditor.setBrushDrawingMode(false);
doodleSeekBar.setVisibility(View.GONE);
mDoodleButton.setText(R.string.enable_doodle_effect);
mDoodleButton.setBackgroundColor(getResources().getColor(android.R.color.holo_orange_dark));
colorLayout.setVisibility(View.GONE);
}
}

@Override
public void onBackPressed() {
done();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
}

if (fragment != null) {
fragmentManager.beginTransaction().replace(R.id.content, fragment).commit();
fragmentManager.beginTransaction().addToBackStack(null).replace(R.id.content, fragment).commit();
}

DrawerLayout drawer = findViewById(R.id.drawer_layout);
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_border_outer_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M13,7h-2v2h2L13,7zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM3,3v18h18L21,3L3,3zM19,19L5,19L5,5h14v14zM13,15h-2v2h2v-2zM9,11L7,11v2h2v-2z"/>
</vector>
65 changes: 63 additions & 2 deletions app/src/main/res/layout/activity_photo_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
tools:context=".activity.ImageEditor">

<ScrollView
android:id="@+id/scrollViewImage"
android:layout_width="match_parent"
android:layout_height="378dp"
android:layout_alignParentStart="true"
Expand Down Expand Up @@ -88,13 +89,73 @@
android:text="@string/reset"
android:textAllCaps="false"
android:textColor="@android:color/white" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/doodleButton"
android:layout_marginStart="10dp"
android:layout_marginBottom="5dp"
android:text="@string/enable_doodle_effect"
android:textAllCaps="false"
android:background="@android:color/holo_orange_dark"
android:layout_above="@+id/recyclerView"/>
<SeekBar
android:id="@+id/doodleSeekBar"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:visibility="gone"
android:layout_toEndOf="@id/doodleButton"
android:layout_above="@id/doodle_colors"
android:max="100"
android:progress="30"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/recyclerView"
android:id="@+id/doodle_colors"
android:padding="3dp"
android:visibility="gone"
android:background="@color/gray_background"
android:layout_marginStart="10dp"
android:layout_toEndOf="@id/doodleButton"
android:orientation="horizontal">
<Button
android:id="@+id/doodle_color_white"
android:layout_width="30dp"
android:layout_margin="3dp"
android:background="@color/mb_white"
android:layout_height="20dp" />
<Button
android:id="@+id/doodle_color_red"
android:layout_width="30dp"
android:layout_margin="3dp"
android:background="@color/red"
android:layout_height="20dp" />
<Button
android:id="@+id/doodle_color_black"
android:layout_width="30dp"
android:layout_margin="3dp"
android:background="@color/black_87"
android:layout_height="30dp" />
<Button
android:id="@+id/doodle_color_blue"
android:layout_width="30dp"
android:layout_margin="3dp"
android:background="@color/mb_blue"
android:layout_height="30dp" />
<Button
android:id="@+id/doodle_color_green"
android:layout_width="30dp"
android:layout_margin="3dp"
android:background="@color/mb_green"
android:layout_height="30dp" />
</LinearLayout>

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#e6e4e4"
android:orientation="horizontal"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,8 @@
<string name="image_rearranging_options">Image Rearranging Options</string>
<string name="filter_file_name">%s_%s.jpg</string>
<string name="reset">Reset</string>
<string name="border">Add Image Border</string>
<string name="enable_doodle_effect">Enable Doodle Effect</string>
<string name="disable_doodle_effect">Disable Doodle Effect</string>
<string name="select_as">Select as:</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,8 @@
<string name="image_rearranging_options">Image Rearranging Options</string>
<string name="filter_file_name">%s_%s.jpg</string>
<string name="reset">Reset</string>
<string name="border">Add Image Border</string>
<string name="enable_doodle_effect">Enable Doodle Effect</string>
<string name="disable_doodle_effect">Disable Doodle Effect</string>
<string name="select_as">Select as:</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,8 @@
<string name="image_rearranging_options">Image Rearranging Options</string>
<string name="filter_file_name">%s_%s.jpg</string>
<string name="reset">Reset</string>
<string name="border">Add Image Border</string>
<string name="enable_doodle_effect">Enable Doodle Effect</string>
<string name="disable_doodle_effect">Disable Doodle Effect</string>
<string name="select_as">Select as:</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<color name="colorGray">#607D8B</color>
<color name="gray_background">#eceff1</color>
<color name="black">#000000</color>
<color name="red">#FF0000</color>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,8 @@
<string name="image_rearranging_options">Image Rearranging Options</string>
<string name="filter_file_name">%s_%s.jpg</string>
<string name="reset">Reset</string>
<string name="border">Add Image Border</string>
<string name="enable_doodle_effect">Enable Doodle Effect</string>
<string name="disable_doodle_effect">Disable Doodle Effect</string>
<string name="select_as">Select as:</string>
</resources>