-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ooyala/candidate
update candidate
- Loading branch information
Showing
91 changed files
with
1,695 additions
and
768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ContentProtectionSampleApp/app/src/main/java/com/ooyala/sample/complete/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.ooyala.sample.complete; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.AdapterView; | ||
import android.widget.AdapterView.OnItemClickListener; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.ListView; | ||
|
||
import com.ooyala.sample.R; | ||
import com.ooyala.sample.lists.ContentProtectionListActivity; | ||
|
||
import com.ooyala.sample.players.CustomActivity; | ||
|
||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* This is the opening activity for the app. | ||
* | ||
* | ||
*/ | ||
public class MainActivity extends Activity implements OnItemClickListener { | ||
final String TAG = this.getClass().toString(); | ||
|
||
private static Map<String, Class<? extends Activity>> activityMap; | ||
ArrayAdapter<String> mainListAdapter; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.list_activity_layout); | ||
activityMap = new LinkedHashMap<String, Class<? extends Activity>>(); | ||
mainListAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); | ||
activityMap.put(ContentProtectionListActivity.getName(), ContentProtectionListActivity.class); | ||
activityMap.put(CustomActivity.getName(), CustomActivity.class); | ||
for(String key : activityMap.keySet()) { | ||
mainListAdapter.add(key); | ||
} | ||
mainListAdapter.notifyDataSetChanged(); | ||
ListView mainListView = (ListView) findViewById(R.id.mainActivityListView); | ||
mainListView.setAdapter(mainListAdapter); | ||
mainListView.setOnItemClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onItemClick(AdapterView<?> l, View v, int pos, long id) { | ||
Class<? extends Activity> selectedClass = activityMap.get(mainListAdapter.getItem(pos)); | ||
Intent intent = new Intent(this, selectedClass); | ||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||
startActivity(intent); | ||
return; | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
ContentProtectionSampleApp/app/src/main/java/com/ooyala/sample/players/CustomActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.ooyala.sample.players; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.Button; | ||
import android.widget.CheckBox; | ||
import android.widget.EditText; | ||
import android.widget.Spinner; | ||
import android.widget.Toast; | ||
import com.ooyala.sample.R; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
|
||
public class CustomActivity extends Activity { | ||
public static String getName() { | ||
return "Asset Options"; | ||
} | ||
private EditText embedCodeEditText; | ||
private EditText pCodeEditText; | ||
private EditText apiKeyEditText; | ||
private EditText secretEditText; | ||
private EditText accountIdEditText; | ||
private String embedCode; | ||
private String pCode; | ||
private String apiKey; | ||
private String secret; | ||
private String accountId; | ||
private CheckBox autoPlayCheckBox; | ||
private boolean autoPlay; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.embed_pcode_layout); | ||
embedCodeEditText = findViewById(R.id.embed_edit_text); | ||
pCodeEditText = findViewById(R.id.pcode_edit_text); | ||
apiKeyEditText = findViewById(R.id.apikey_edit_text); | ||
secretEditText = findViewById(R.id.secret_edit_text); | ||
accountIdEditText = findViewById(R.id.accountid_edit_text); | ||
autoPlayCheckBox = findViewById(R.id.auto_play_check_box); | ||
initButtonListeners(); | ||
} | ||
|
||
private void initButtonListeners() { | ||
Button setAssetButton = findViewById(R.id.play_button); | ||
setAssetButton.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
embedCode = embedCodeEditText.getText().toString(); | ||
pCode = pCodeEditText.getText().toString(); | ||
apiKey = apiKeyEditText.getText().toString(); | ||
secret = secretEditText.getText().toString(); | ||
accountId = accountIdEditText.getText().toString(); | ||
autoPlay = autoPlayCheckBox.isChecked() ? true : false; | ||
if (embedCode.isEmpty()) { | ||
Toast.makeText(CustomActivity.this, "Embed code can't be empty!", Toast.LENGTH_LONG).show(); | ||
return; | ||
} | ||
if (pCode.isEmpty()) { | ||
Toast.makeText(CustomActivity.this, "PCode can't be empty!", Toast.LENGTH_LONG).show(); | ||
return; | ||
} | ||
startPlayerActivity(); | ||
} | ||
}); | ||
} | ||
|
||
|
||
private void startPlayerActivity() { | ||
//PlayerActivity map | ||
//Launch the correct activity | ||
Intent intent = new Intent(this, OoyalaPlayerTokenPlayerActivity.class); | ||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||
intent.putExtra("embed_code", embedCode); | ||
intent.putExtra("pcode", pCode); | ||
intent.putExtra("domain", "http://www.ooyala.com"); | ||
intent.putExtra("autoPlay", autoPlay); | ||
intent.putExtra("apikey", apiKey); | ||
intent.putExtra("secret", secret); | ||
intent.putExtra("accountid", accountId); | ||
startActivity(intent); | ||
} | ||
} |
Oops, something went wrong.