Skip to content

Commit

Permalink
Merge pull request #43 from hatt0519/master
Browse files Browse the repository at this point in the history
Enabled to change the title
  • Loading branch information
a914-gowtham committed Apr 12, 2021
2 parents 66e8f93 + 003d1e6 commit 5e25f1b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.act_video_trimmer);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setUpToolBar(getSupportActionBar(), getString(R.string.txt_edt_video));
TrimVideoOptions trimVideoOptions = getIntent().getParcelableExtra(TrimVideo.TRIM_VIDEO_OPTION);
setUpToolBar(getSupportActionBar(), trimVideoOptions.title);
toolbar.setNavigationOnClickListener(v -> finish());
progressView = new CustomProgressView(this);
}
Expand Down Expand Up @@ -151,7 +152,7 @@ private void setUpToolBar(ActionBar actionBar, String title) {
try {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setTitle(title);
actionBar.setTitle(title != null ? title : getString(R.string.txt_edt_video));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.gowtham.library.utils;


import android.app.Activity;
import android.content.Intent;

Expand Down Expand Up @@ -82,11 +81,16 @@ public ActivityBuilder setMinToMax(long min, long max) {
return this;
}

public ActivityBuilder setTitle(String title) {
options.title = title;
return this;
}

public void start(Activity activity) {
validate();
activity.startActivityForResult(getIntent(activity), VIDEO_TRIMMER_REQ_CODE);
}

public void start(Fragment fragment) {
validate();
fragment.startActivityForResult(getIntent(fragment.getActivity()), VIDEO_TRIMMER_REQ_CODE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class TrimVideoOptions implements Parcelable {

public long[] minToMax;

public String title;

public CompressOption compressOption;

public TrimVideoOptions() {
Expand All @@ -39,6 +41,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeByte(this.accurateCut ? (byte) 1 : (byte) 0);
dest.writeByte(this.showFileLocationAlert ? (byte) 1 : (byte) 0);
dest.writeLongArray(this.minToMax);
dest.writeString(this.title);
dest.writeParcelable(this.compressOption, flags);
}

Expand All @@ -52,6 +55,7 @@ protected TrimVideoOptions(Parcel in) {
this.accurateCut = in.readByte() != 0;
this.showFileLocationAlert = in.readByte() != 0;
this.minToMax = in.createLongArray();
this.title = in.readString();
this.compressOption = in.readParcelable(CompressOption.class.getClassLoader());
}

Expand Down

0 comments on commit 5e25f1b

Please sign in to comment.