// Path: playerSDK/src/main/java/com/kaltura/playersdk/BrowserActivity.java
// public class BrowserActivity extends Activity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_browser);
//         Bundle extras = getIntent().getExtras();
//         String shareLink = extras.getString("ShareLink");
//         if (shareLink != null) {
//             WebView webView = (WebView)findViewById(R.id.browserWebView);
//             webView.setWebViewClient(new WebViewClient());
//             webView.loadUrl(shareLink);
//         }
//         ActionBar actionBar = getActionBar();
//         if(actionBar != null) {
//             actionBar.setHomeButtonEnabled(true);
//             actionBar.setDisplayHomeAsUpEnabled(true);
//             actionBar.setTitle(extras.getString("VideoName"));
//             String barColor = extras.getString("BarColor");
//             if(barColor != null && !barColor.isEmpty()){
//                 actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(barColor)));
//             }
//         }
// 
//     }
// 
// 
// 
//     @Override
//     public boolean onCreateOptionsMenu(Menu menu) {
//         // Inflate the menu; this adds items to the action bar if it is present.
//         //getMenuInflater().inflate(R.menu.menu_browser, menu);
//         return true;
//     }
// 
//     @Override
//     public boolean onPrepareOptionsMenu(Menu menu) {
// 
//         return super.onPrepareOptionsMenu(menu);
// 
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         finish();
//         overridePendingTransition(R.animator.trans_right_in, R.animator.trans_right_out);
//         return super.onOptionsItemSelected(item);
//     }
// 
// 
// }
// 
// Path: playerSDK/src/main/java/com/kaltura/playersdk/actionHandlers/ShareManager.java
// public class ShareManager {
// 
//     public static final String TAG = ShareManager.class.getSimpleName();
// 
//     public static void share(JSONObject dataSource, Activity activity) {
//         KPShareStrategy strategy = ShareStrategyFactory.getStrategy(dataSource);
//         if (strategy != null)
//         {
//             strategy.share(dataSource, activity);
//         }
// 
//     }
// 
//     public interface KPShareStrategy {
//         public void share(JSONObject dataSource, Activity activity);
//     }
// 
//     public static enum SharingType{
//         SHARE_FACEBOOK("Facebook"),
//         SHARE_TWITTER("Twitter"),
//         SHARE_LINKEDIN("Linkedin"),
//         SHARE_EMAIL("Email"),
//         SHARE_SMS("Sms"),
//         SHARE_GOOGLE_PLUS("Googleplus");
// 
//         private String label;
// 
//         private SharingType(String str) {
//             this.label = str;
//         }
// 
//         public String toString() {
//             return this.label;
//         }
// 
//         public static SharingType fromString(String label) {
//             if (label != null) {
//                 for (SharingType sharingKey : SharingType.values()) {
//                     if (label.equalsIgnoreCase(sharingKey.label)) {
//                         return sharingKey;
//                     }
//                 }
//             }
// 
//             return null;
//         }
// 
//     }
// 
// }


import android.app.Activity;
import android.content.Intent;
import com.kaltura.playersdk.R;
import com.kaltura.playersdk.BrowserActivity;
import com.kaltura.playersdk.actionHandlers.ShareManager;
import org.json.JSONException;
import org.json.JSONObject;
package com.kaltura.playersdk.actionHandlers.ShareStrategies;




/**
 * Created by itayi on 3/5/15.
 */
public class WebShareStrategy implements ShareManager.KPShareStrategy {
    @Override
    public void share(JSONObject shareParams, Activity activity) {
        String sharePrefix = "";
        String videoLink = "";
        String videoName = "";
        String barColor = "";
        try {
            sharePrefix = ((String)((JSONObject)shareParams.get("shareNetwork")).get("template")).replace("{share.shareURL}", "");
            videoLink = (String)shareParams.get("sharedLink");
            videoName = (String)shareParams.get("videoName");
            barColor = (String)((JSONObject)shareParams.get("shareNetwork")).get("barColor");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        String shareScheme = sharePrefix + videoLink;
// Path: playerSDK/src/main/java/com/kaltura/playersdk/BrowserActivity.java
// public class BrowserActivity extends Activity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_browser);
//         Bundle extras = getIntent().getExtras();
//         String shareLink = extras.getString("ShareLink");
//         if (shareLink != null) {
//             WebView webView = (WebView)findViewById(R.id.browserWebView);
//             webView.setWebViewClient(new WebViewClient());
//             webView.loadUrl(shareLink);
//         }
//         ActionBar actionBar = getActionBar();
//         if(actionBar != null) {
//             actionBar.setHomeButtonEnabled(true);
//             actionBar.setDisplayHomeAsUpEnabled(true);
//             actionBar.setTitle(extras.getString("VideoName"));
//             String barColor = extras.getString("BarColor");
//             if(barColor != null && !barColor.isEmpty()){
//                 actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(barColor)));
//             }
//         }
// 
//     }
// 
// 
// 
//     @Override
//     public boolean onCreateOptionsMenu(Menu menu) {
//         // Inflate the menu; this adds items to the action bar if it is present.
//         //getMenuInflater().inflate(R.menu.menu_browser, menu);
//         return true;
//     }
// 
//     @Override
//     public boolean onPrepareOptionsMenu(Menu menu) {
// 
//         return super.onPrepareOptionsMenu(menu);
// 
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         finish();
//         overridePendingTransition(R.animator.trans_right_in, R.animator.trans_right_out);
//         return super.onOptionsItemSelected(item);
//     }
// 
// 
// }
// 
// Path: playerSDK/src/main/java/com/kaltura/playersdk/actionHandlers/ShareManager.java
// public class ShareManager {
// 
//     public static final String TAG = ShareManager.class.getSimpleName();
// 
//     public static void share(JSONObject dataSource, Activity activity) {
//         KPShareStrategy strategy = ShareStrategyFactory.getStrategy(dataSource);
//         if (strategy != null)
//         {
//             strategy.share(dataSource, activity);
//         }
// 
//     }
// 
//     public interface KPShareStrategy {
//         public void share(JSONObject dataSource, Activity activity);
//     }
// 
//     public static enum SharingType{
//         SHARE_FACEBOOK("Facebook"),
//         SHARE_TWITTER("Twitter"),
//         SHARE_LINKEDIN("Linkedin"),
//         SHARE_EMAIL("Email"),
//         SHARE_SMS("Sms"),
//         SHARE_GOOGLE_PLUS("Googleplus");
// 
//         private String label;
// 
//         private SharingType(String str) {
//             this.label = str;
//         }
// 
//         public String toString() {
//             return this.label;
//         }
// 
//         public static SharingType fromString(String label) {
//             if (label != null) {
//                 for (SharingType sharingKey : SharingType.values()) {
//                     if (label.equalsIgnoreCase(sharingKey.label)) {
//                         return sharingKey;
//                     }
//                 }
//             }
// 
//             return null;
//         }
// 
//     }
// 
// }


// Path: playerSDK/src/main/java/com/kaltura/playersdk/actionHandlers/ShareStrategies/WebShareStrategy.java
import android.app.Activity;
import android.content.Intent;
import com.kaltura.playersdk.R;
import com.kaltura.playersdk.BrowserActivity;
import com.kaltura.playersdk.actionHandlers.ShareManager;
import org.json.JSONException;
import org.json.JSONObject;

package com.kaltura.playersdk.actionHandlers.ShareStrategies;




/**
 * Created by itayi on 3/5/15.
 */
public class WebShareStrategy implements ShareManager.KPShareStrategy {
    @Override
    public void share(JSONObject shareParams, Activity activity) {
        String sharePrefix = "";
        String videoLink = "";
        String videoName = "";
        String barColor = "";
        try {
            sharePrefix = ((String)((JSONObject)shareParams.get("shareNetwork")).get("template")).replace("{share.shareURL}", "");
            videoLink = (String)shareParams.get("sharedLink");
            videoName = (String)shareParams.get("videoName");
            barColor = (String)((JSONObject)shareParams.get("shareNetwork")).get("barColor");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        String shareScheme = sharePrefix + videoLink;
        Intent shareIntent = new Intent(activity, BrowserActivity.class);