Add new assistant fragment for Codec Downloader + update linphone
This commit is contained in:
parent
ff0ad63b01
commit
6bd92c40b7
9 changed files with 335 additions and 88 deletions
105
res/layout/assistant_codec_downloader.xml
Normal file
105
res/layout/assistant_codec_downloader.xml
Normal file
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="30dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:text="@string/assistant_codec_down_question"
|
||||
style="@style/font7"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:id="@+id/question"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/linphone_logo_orange"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_below="@+id/question"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="36dp"/>
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_above="@+id/answerNo"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
<TextView
|
||||
style="@style/font7"
|
||||
android:text="@string/assistant_codec_downloading"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:id="@+id/downloading"
|
||||
android:layout_above="@+id/imageView"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<Button
|
||||
style="@style/font7"
|
||||
android:text="No"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:id="@+id/answerNo"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toLeftOf="@+id/imageView"
|
||||
android:layout_toStartOf="@+id/imageView"
|
||||
android:layout_marginRight="26dp"
|
||||
android:layout_marginEnd="26dp"/>
|
||||
|
||||
<Button
|
||||
style="@style/font7"
|
||||
android:text="Yes"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:id="@+id/answerYes"
|
||||
android:layout_below="@+id/progressBar"
|
||||
android:layout_toRightOf="@+id/imageView"
|
||||
android:layout_toEndOf="@+id/imageView"/>
|
||||
|
||||
<TextView
|
||||
style="@style/font7"
|
||||
android:text="@string/assistant_codec_downloaded"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:id="@+id/downloaded"
|
||||
android:layout_above="@+id/imageView"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<TextView
|
||||
style="@style/font7"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:id="@+id/downloadingInfo"
|
||||
android:layout_above="@+id/progressBar"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -78,6 +78,9 @@
|
|||
<string name="assistant_account_not_validated">Your account has not been validated yet.</string>
|
||||
<string name="assistant_account_validated">Your account has been validated.</string>
|
||||
<string name="assistant_error_bad_credentials">Incorrect username or password</string>
|
||||
<string name="assistant_codec_down_question">Do you agree to download OpenH264 Video Codec provided by Cisco Systems, Inc.?</string>
|
||||
<string name="assistant_codec_downloading">Downloading OpenH264 Video Codec provided by Cisco Systems, Inc.</string>
|
||||
<string name="assistant_codec_downloaded">OpenH264 Video Codec provided by Cisco Systems, Inc. downloaded.</string>
|
||||
<string name="wizard_failed">An error occurred, try again later.</string>
|
||||
<string name="wizard_server_unavailable">Server unreachable, verify your network connection.</string>
|
||||
<string name="wizard_username_unavailable">This username is already in use.</string>
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.TimerTask;
|
|||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.CodecDownloadAction;
|
||||
import org.linphone.core.CodecDownloadListener;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneBuffer;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
|
@ -142,6 +144,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
private LinphonePreferences mPrefs;
|
||||
private LinphoneCore mLc;
|
||||
private CodecDownloader mCodecDownloader;
|
||||
private CodecDownloadListener mCodecListener;
|
||||
private CodecDownloadAction mCodecAction;
|
||||
private String lastLcStatusMessage;
|
||||
private String basePath;
|
||||
private static boolean sExited;
|
||||
|
@ -220,116 +224,94 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
mLc.enableSpeaker(speakerOn);
|
||||
}
|
||||
|
||||
private void initCodecDownloader() {
|
||||
mCodecDownloader = new CodecDownloader() {
|
||||
Context ctxt = mServiceContext;
|
||||
public void initCodecDownloader() {
|
||||
mCodecListener = new CodecDownloadListener() {
|
||||
ProgressDialog progress;
|
||||
CheckBoxPreference box;
|
||||
int box = 1;
|
||||
int ctxt = 0;
|
||||
|
||||
@Override
|
||||
public void listenerDownloadStarting() {
|
||||
if (mServiceContext == null) return;
|
||||
public void listenerUpdateProgressBar(final int current, final int max) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progress = new ProgressDialog(ctxt);
|
||||
progress.setCanceledOnTouchOutside(false);
|
||||
progress.setCancelable(false);
|
||||
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||
if (progress == null) {
|
||||
progress = new ProgressDialog((Context)LinphoneManager.getInstance().getCodecDownloader().getUserData(ctxt));
|
||||
progress.setCanceledOnTouchOutside(false);
|
||||
progress.setCancelable(false);
|
||||
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||
} else if (current <= max) {
|
||||
progress.setMessage("Downloading OpenH264");
|
||||
progress.setMax(max);
|
||||
progress.setProgress(current);
|
||||
progress.show();
|
||||
} else {
|
||||
progress.dismiss();
|
||||
progress = null;
|
||||
LinphoneCoreFactoryImpl.loadOptionalLibraryWithPath(((Context)LinphoneManager.getInstance().getCodecDownloader().getUserData(ctxt)).getFilesDir() + "/" + CodecDownloader.getNameLib());
|
||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||
if (LinphoneManager.getInstance().getCodecDownloader().getUserDataSize() > box
|
||||
&& LinphoneManager.getInstance().getCodecDownloader().getUserData(box) != null)
|
||||
((CheckBoxPreference)LinphoneManager.getInstance().getCodecDownloader().getUserData(box)).setSummary(CodecDownloader.getLicenseMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listenerUpdateMsg(final int now, final int max) {
|
||||
if (progress == null) return;
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progress.setMessage("Downloading OpenH264");
|
||||
progress.setMax(max);
|
||||
progress.setProgress(now);
|
||||
progress.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listenerDownloadEnding() {
|
||||
if (progress == null) return;
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progress.dismiss();
|
||||
LinphoneCoreFactoryImpl.loadOptionalLibraryWithPath(ctxt.getFilesDir()+"/" + CodecDownloader.getNameLib());
|
||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);
|
||||
builder.setMessage(CodecDownloader.getLicenseMessage() + " downloaded");
|
||||
builder.setCancelable(false);
|
||||
builder.setNeutralButton("Ok", null);
|
||||
builder.show();
|
||||
if (box != null) box.setSummary(CodecDownloader.getLicenseMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listenerDownloadFailed(final String error) {
|
||||
public void listenerDownloadFailed (final String error){
|
||||
if (progress == null) return;
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (progress != null) progress.dismiss();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder((Context)LinphoneManager.getInstance().getCodecDownloader().getUserData(ctxt));
|
||||
builder.setMessage(error);
|
||||
builder.setCancelable(false);
|
||||
builder.setNeutralButton("Ok", null);
|
||||
builder.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
mCodecAction = new CodecDownloadAction() {
|
||||
@Override
|
||||
public void startDownload(Context context, Object obj) {
|
||||
box = (CheckBoxPreference)obj;
|
||||
ctxt = context;
|
||||
public void startDownload() {
|
||||
askPopUp();
|
||||
}
|
||||
|
||||
|
||||
public void askPopUp() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
|
||||
builder.setCancelable(false);
|
||||
AlertDialog.Builder show = builder.setMessage("Do you want to download "
|
||||
AlertDialog.Builder show = builder.setMessage("Do you agree to download "
|
||||
+ CodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE)
|
||||
mCodecDownloader.downloadCodec();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("No", new DialogInterface.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_NEGATIVE){
|
||||
// Disable H264
|
||||
PayloadType h264 = null;
|
||||
for (PayloadType pt : mLc.getVideoCodecs()) {
|
||||
if (pt.getMime().equals("H264")) h264 = pt;
|
||||
}
|
||||
|
||||
if (h264 == null) return;
|
||||
|
||||
if (LinphonePreferences.instance().isFirstLaunch()) {
|
||||
try {
|
||||
mLc.enablePayloadType(h264, false);
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
};
|
||||
mCodecDownloader = new CodecDownloader();
|
||||
mCodecDownloader.setCodecDownloadlistener(mCodecListener);
|
||||
mCodecDownloader.setCodecDownloadAction(mCodecAction);
|
||||
}
|
||||
|
||||
public CodecDownloadListener getCodecDownloadListener() {
|
||||
return mCodecListener;
|
||||
}
|
||||
|
||||
public CodecDownloadAction getCodecDownloadAction() {
|
||||
return mCodecAction;
|
||||
}
|
||||
|
||||
public CodecDownloader getCodecDownloader(){
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.linphone.tools.CodecDownloader;
|
|||
import org.linphone.ui.LedPreference;
|
||||
import org.linphone.ui.PreferencesListFragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.CheckBoxPreference;
|
||||
|
@ -540,7 +539,6 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
|
||||
private void initVideoSettings() {
|
||||
final Context ctxt = LinphoneManager.getInstance().getContext();
|
||||
initializePreferredVideoSizePreferences((ListPreference) findPreference(getString(R.string.pref_preferred_video_size_key)));
|
||||
initializePreferredVideoFpsPreferences((ListPreference) findPreference(getString(R.string.pref_preferred_video_fps_key)));
|
||||
EditTextPreference bandwidth = (EditTextPreference) findPreference(getString(R.string.pref_bandwidth_limit_key));
|
||||
|
@ -581,9 +579,14 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enable = (Boolean) newValue;
|
||||
try {
|
||||
CodecDownloader.setFileDirection(LinphoneManager.getInstance().getContext().getFilesDir().toString());
|
||||
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
|
||||
&& pt.getMime().equals("H264") && !CodecDownloader.codecExist()) {
|
||||
LinphoneManager.getInstance().getCodecDownloader().startDownload(ctxt, codec);
|
||||
LinphoneManager.getInstance().getCodecDownloader().setCodecDownloadlistener(LinphoneManager.getInstance().getCodecDownloadListener());
|
||||
LinphoneManager.getInstance().getCodecDownloader().setCodecDownloadAction(LinphoneManager.getInstance().getCodecDownloader().getCodecDownloadAction());
|
||||
LinphoneManager.getInstance().getCodecDownloader().setUserData(0,LinphoneManager.getInstance().getContext());
|
||||
LinphoneManager.getInstance().getCodecDownloader().setUserData(1,codec);
|
||||
LinphoneManager.getInstance().getCodecDownloader().getCodecDownloadAction().startDownload();
|
||||
}
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
|
||||
} catch (LinphoneCoreException e) {
|
||||
|
|
|
@ -27,12 +27,13 @@ import org.linphone.core.LinphoneAddress;
|
|||
import org.linphone.core.LinphoneAddress.TransportType;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.tools.CodecDownloader;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
|
@ -242,10 +243,10 @@ private static AssistantActivity instance;
|
|||
if (getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
||||
launchEchoCancellerCalibration(true);
|
||||
} else {
|
||||
success();
|
||||
launchDownloadCodec();
|
||||
}
|
||||
} else {
|
||||
success();
|
||||
launchDownloadCodec();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +261,7 @@ private static AssistantActivity instance;
|
|||
back.setVisibility(View.VISIBLE);
|
||||
cancel.setEnabled(false);
|
||||
} else {
|
||||
success();
|
||||
launchDownloadCodec();
|
||||
}
|
||||
} else {
|
||||
checkAndRequestAudioPermission();
|
||||
|
@ -353,6 +354,22 @@ private static AssistantActivity instance;
|
|||
//LinphoneManager.getInstance().restartLinphoneCore();
|
||||
}
|
||||
|
||||
private void launchDownloadCodec() {
|
||||
CodecDownloader.setFileDirection(LinphoneManager.getInstance().getContext().getFilesDir().toString());
|
||||
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !CodecDownloader.codecExist()) {
|
||||
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
|
||||
changeFragment(codecFragment);
|
||||
currentFragment = AssistantFragmentsEnum.DOWNLOAD_CODEC;
|
||||
back.setVisibility(View.VISIBLE);
|
||||
cancel.setEnabled(false);
|
||||
} else
|
||||
endDownloadCodec();
|
||||
}
|
||||
|
||||
public void endDownloadCodec() {
|
||||
success();
|
||||
}
|
||||
|
||||
public void saveCreatedAccount(String username, String password, String displayName, String domain, TransportType transport) {
|
||||
if (accountCreated)
|
||||
return;
|
||||
|
@ -484,7 +501,7 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
public void isEchoCalibrationFinished() {
|
||||
success();
|
||||
launchDownloadCodec();
|
||||
}
|
||||
|
||||
public Dialog createErrorDialog(LinphoneProxyConfig proxy, String message){
|
||||
|
|
|
@ -27,5 +27,6 @@ public enum AssistantFragmentsEnum {
|
|||
LINPHONE_LOGIN,
|
||||
LOGIN,
|
||||
REMOTE_PROVISIONING,
|
||||
ECHO_CANCELLER_CALIBRATION;
|
||||
ECHO_CANCELLER_CALIBRATION,
|
||||
DOWNLOAD_CODEC;
|
||||
}
|
||||
|
|
146
src/org/linphone/assistant/CodecDownloaderFragment.java
Normal file
146
src/org/linphone/assistant/CodecDownloaderFragment.java
Normal file
|
@ -0,0 +1,146 @@
|
|||
package org.linphone.assistant;
|
||||
|
||||
/*
|
||||
CodecDownloaderFragment.java
|
||||
Copyright (C) 2016 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CodecDownloadListener;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactoryImpl;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.tools.CodecDownloader;
|
||||
|
||||
/**
|
||||
* @author Erwan CROZE
|
||||
*/
|
||||
public class CodecDownloaderFragment extends Fragment {
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.assistant_codec_downloader, container, false);
|
||||
|
||||
final TextView question = (TextView) view.findViewById(R.id.question);
|
||||
final TextView downloading = (TextView) view.findViewById(R.id.downloading);
|
||||
final TextView downloaded = (TextView) view.findViewById(R.id.downloaded);
|
||||
final TextView yes = (TextView) view.findViewById(R.id.answerYes);
|
||||
final TextView no = (TextView) view.findViewById(R.id.answerNo);
|
||||
final ProgressBar bar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||
final TextView downloadingInfo = (TextView) view.findViewById(R.id.downloadingInfo);
|
||||
|
||||
CodecDownloader.setFileDirection(LinphoneManager.getInstance().getContext().getFilesDir().toString());
|
||||
|
||||
final CodecDownloader codecDownloader = new CodecDownloader();
|
||||
final CodecDownloadListener codecListener = new CodecDownloadListener() {
|
||||
|
||||
@Override
|
||||
public void listenerUpdateProgressBar(final int current, final int max) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (current <= max) {
|
||||
downloadingInfo.setText(current + " / " + max);
|
||||
downloadingInfo.setVisibility(View.VISIBLE);
|
||||
bar.setMax(max);
|
||||
bar.setProgress(current);
|
||||
bar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
downloadingInfo.setVisibility(View.INVISIBLE);
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
LinphoneCoreFactoryImpl.loadOptionalLibraryWithPath(LinphoneManager.getInstance().getContext().getFilesDir() + "/" + CodecDownloader.getNameLib());
|
||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||
downloading.setVisibility(View.INVISIBLE);
|
||||
downloaded.setVisibility(View.VISIBLE);
|
||||
AssistantActivity.instance().endDownloadCodec();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listenerDownloadFailed (final String error){
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
question.setVisibility(View.INVISIBLE);
|
||||
downloading.setVisibility(View.INVISIBLE);
|
||||
yes.setVisibility(View.INVISIBLE);
|
||||
no.setVisibility(View.INVISIBLE);
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
downloadingInfo.setVisibility(View.INVISIBLE);
|
||||
downloaded.setText(error);
|
||||
downloaded.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
codecDownloader.setCodecDownloadlistener(codecListener);
|
||||
downloading.setVisibility(View.INVISIBLE);
|
||||
downloaded.setVisibility(View.INVISIBLE);
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
downloadingInfo.setVisibility(View.INVISIBLE);
|
||||
|
||||
yes.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
question.setVisibility(View.INVISIBLE);
|
||||
yes.setVisibility(View.INVISIBLE);
|
||||
no.setVisibility(View.INVISIBLE);
|
||||
downloading.setVisibility(View.VISIBLE);
|
||||
bar.setVisibility(View.VISIBLE);
|
||||
downloadingInfo.setVisibility(View.INVISIBLE);
|
||||
codecDownloader.downloadCodec();
|
||||
}
|
||||
});
|
||||
|
||||
no.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PayloadType h264 = null;
|
||||
for (PayloadType pt : LinphoneManager.getLc().getVideoCodecs()) {
|
||||
if (pt.getMime().equals("H264")) h264 = pt;
|
||||
}
|
||||
|
||||
if (h264 != null) {
|
||||
try {
|
||||
LinphoneManager.getLc().enablePayloadType(h264, false);
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
AssistantActivity.instance().endDownloadCodec();
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -17,11 +17,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.tools.CodecDownloader;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
|
@ -42,12 +38,6 @@ public class WelcomeFragment extends Fragment implements OnClickListener {
|
|||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_welcome, container, false);
|
||||
|
||||
LinphoneManager.getInstance().getCodecDownloader().setFileDirection(getContext().getFilesDir().toString());
|
||||
if (LinphonePreferences.instance().isFirstLaunch() && Version.getCpuAbis().contains("armeabi-v7a")
|
||||
&& !Version.getCpuAbis().contains("x86") && !CodecDownloader.codecExist()) {
|
||||
LinphoneManager.getInstance().getCodecDownloader().startDownload(getContext(), null);
|
||||
}
|
||||
|
||||
createAccount = (Button) view.findViewById(R.id.create_account);
|
||||
createAccount.setOnClickListener(this);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c4d988bba2eeac1cb5253d3210a831cbe10120c0
|
||||
Subproject commit b6bfc2dcb4ab2a3281cb3246f2862a06d3b43b58
|
Loading…
Reference in a new issue