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

Android studio 3 compatibility and dependencies updated #247

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
structured code
ashishg656 committed Nov 23, 2017
commit dd93aa88dec206234538680a77e838cdb52fb99a
Original file line number Diff line number Diff line change
@@ -12,18 +12,19 @@
import com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.sampleffmpeg.screens.home.HomeActivity;

import static org.assertj.core.api.Assertions.assertThat;

public class FFmpegInstrumentationTest extends ActivityInstrumentationTestCase2<Home> {
public class FFmpegInstrumentationTest extends ActivityInstrumentationTestCase2<HomeActivity> {

private static final String TAG = FFmpegInstrumentationTest.class.getSimpleName();

@Inject
FFmpeg ffmpeg;

public FFmpegInstrumentationTest() {
super(Home.class);
super(HomeActivity.class);
}

@Override
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -5,13 +5,13 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".BaseApplication"
android:name=".core.BaseApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".Home"
android:name=".screens.home.HomeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.hiteshsondhi88.sampleffmpeg;
package com.github.hiteshsondhi88.sampleffmpeg.core;

import android.content.Context;
import android.os.Bundle;
@@ -8,6 +8,8 @@
import android.view.MenuItem;
import android.view.View;

import com.github.hiteshsondhi88.sampleffmpeg.R;

import javax.inject.Inject;

import butterknife.BindView;
@@ -53,6 +55,4 @@ public boolean onOptionsItemSelected(MenuItem item) {
public Context getContext() {
return this;
}

protected abstract void reloadData();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.github.hiteshsondhi88.sampleffmpeg;
package com.github.hiteshsondhi88.sampleffmpeg.core;

import android.app.Application;
import android.content.Context;

import com.github.hiteshsondhi88.sampleffmpeg.di.component.ApplicationComponent;
import com.github.hiteshsondhi88.sampleffmpeg.di.component.DaggerApplicationComponent;
import com.github.hiteshsondhi88.sampleffmpeg.di.module.DaggerDependencyModule;

/**
* Created by bedi on 01/03/17.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.hiteshsondhi88.sampleffmpeg.di.component;

/**
* Created by navjotsinghbedi on 3/28/16.
*/


import com.github.hiteshsondhi88.sampleffmpeg.di.module.DaggerDependencyModule;
import com.github.hiteshsondhi88.sampleffmpeg.screens.home.HomeActivity;

import javax.inject.Singleton;

import dagger.Component;

@Singleton
@Component(modules = {DaggerDependencyModule.class})
public interface ApplicationComponent {

void inject(HomeActivity homeActivity);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.hiteshsondhi88.sampleffmpeg;
package com.github.hiteshsondhi88.sampleffmpeg.di.module;

import android.content.Context;

@@ -15,7 +15,7 @@ public class DaggerDependencyModule {

private final Context context;

DaggerDependencyModule(Context context) {
public DaggerDependencyModule(Context context) {
this.context = context;
}

Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.github.hiteshsondhi88.sampleffmpeg;
package com.github.hiteshsondhi88.sampleffmpeg.screens.home;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
@@ -17,16 +15,20 @@

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpeg;
import com.github.hiteshsondhi88.libffmpeg.LoadBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
import com.github.hiteshsondhi88.sampleffmpeg.R;
import com.github.hiteshsondhi88.sampleffmpeg.core.BaseActivity;
import com.github.hiteshsondhi88.sampleffmpeg.core.BaseApplication;

public class Home extends Activity implements View.OnClickListener {
public class HomeActivity extends BaseActivity {

private static final String TAG = Home.class.getSimpleName();
private static final String TAG = HomeActivity.class.getSimpleName();

@Inject
FFmpeg ffmpeg;
@@ -50,13 +52,13 @@ protected void onCreate(Bundle savedInstanceState) {

BaseApplication.getInstance().getApplicationComponent().inject(this);

setToolbar(getResources().getString(R.string.app_name), false);

loadFFMpegBinary();
initUI();
}

private void initUI() {
runButton.setOnClickListener(this);

progressDialog = new ProgressDialog(this);
progressDialog.setTitle(null);
}
@@ -115,40 +117,36 @@ public void onFinish() {
}

private void addTextViewToLayout(String text) {
TextView textView = new TextView(Home.this);
TextView textView = new TextView(HomeActivity.this);
textView.setText(text);
outputLayout.addView(textView);
}

private void showUnsupportedExceptionDialog() {
new AlertDialog.Builder(Home.this)
new AlertDialog.Builder(HomeActivity.this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(getString(R.string.device_not_supported))
.setMessage(getString(R.string.device_not_supported_message))
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Home.this.finish();
HomeActivity.this.finish();
}
})
.create()
.show();

}

@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.run_command:
String cmd = commandEditText.getText().toString();
String[] command = cmd.split(" ");
if (command.length != 0) {
execFFmpegBinary(command);
} else {
Toast.makeText(Home.this, getString(R.string.empty_command_toast), Toast.LENGTH_LONG).show();
}
break;
@OnClick(R.id.run_command)
void runCommand() {
String cmd = commandEditText.getText().toString();
String[] command = cmd.split(" ");
if (command.length != 0) {
execFFmpegBinary(command);
} else {
Toast.makeText(HomeActivity.this, getString(R.string.empty_command_toast), Toast.LENGTH_LONG).show();
}
}
}
19 changes: 7 additions & 12 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Home">
tools:context=".screens.home.HomeActivity">

<include layout="@layout/toolbar_layout" />

@@ -16,18 +16,13 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">

<android.support.design.widget.TextInputLayout
<EditText
android:id="@+id/command"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:id="@+id/command"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:hint="@string/ffmpeg_cmd_hint"
android:minLines="3" />
</android.support.design.widget.TextInputLayout>
android:layout_height="wrap_content"
android:gravity="start"
android:hint="@string/ffmpeg_cmd_hint"
android:minLines="3" />

<Button
android:id="@+id/run_command"
6 changes: 2 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -2,12 +2,10 @@
<resources>

<string name="app_name">SampleFFmpeg</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="ffmpeg_cmd_hint">Enter command here. To run \"ffmpeg -version\" enter \"-version\"</string>

<string name="ffmpeg_cmd_hint">Enter command here.To run \"ffmpeg -version\" enter \"-version\"</string>
<string name="device_not_supported">Device not supported</string>
<string name="device_not_supported_message">FFmpeg is not supported on your device</string>
<string name="run">Run</string>
<string name="empty_command_toast">You cannot execute empty command</string>

</resources>