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

Enabled to change the title #43

Merged
merged 2 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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