Android Open Source - videoMerge Base Fragment






From Project

Back to project page videoMerge.

License

The source code is released under:

Apache License

If you think the Android project videoMerge listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dragonplayer.merge.fragment;
//from   w  w  w  .j a  v a2s.com
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;

import com.dragonplayer.merge.MainActivity;
import com.dragonplayer.merge.R;
import com.dragonplayer.merge.adapter.ProjectListAdapter;
import com.dragonplayer.merge.frames.Frames;
import com.dragonplayer.merge.frames.ProjectFiles;
import com.dragonplayer.merge.utils.AppConnectivity;
import com.dragonplayer.merge.utils.DlgWindow4;
 


import com.dragonplayer.merge.utils.MLog;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
/** 
 * 
 * @author ??bar?????
 *
 */
public class BaseFragment extends Fragment {

  public static final int TABLIST = 1;
  public static final int TABLOCK = 2;
  public static final int TABUPLOAD = 3;
  
    ImageView btnList;
    ImageView btnLock;
    ImageView btnUpload;
    
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }
    
    @SuppressLint("ResourceAsColor")
  public void initBottomTab(View view, int selIndex) {
      
      LinearLayout bottomLayout = (LinearLayout) view.findViewById(R.id.bottom_button_layout);
      RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) bottomLayout.getLayoutParams();
      DisplayMetrics displaymetrics = getActivity().getResources().getDisplayMetrics();
      params.height = displaymetrics.widthPixels / 6;
      bottomLayout.setLayoutParams(params);
      
      btnList = (ImageView) view.findViewById(R.id.btnList);
      btnList.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        ((MainActivity)getActivity()).onClickList();
      }
        
      });
      //???????????
      /** btnLock = (ImageView) view.findViewById(R.id.btnLock);
      btnLock.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        ((MainActivity)getActivity()).onClickLock();
      }
        
      }); */

      btnUpload = (ImageView) view.findViewById(R.id.btnUpload);
      btnUpload.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        ((MainActivity)getActivity()).onClickUpload();
        //((MainActivity)getActivity()).onClickAbout();
      }
        
      });
       //?????? btnLock?????
    btnList.setEnabled(true);
    //btnLock.setEnabled(true);
    btnUpload.setEnabled(true);

    btnList.setSelected(false);
    //btnLock.setSelected(false);
    btnUpload.setSelected(false);
    
      if (selIndex == TABLIST) {
        btnList.setEnabled(false);
        btnList.setSelected(true);
      }
      else if (selIndex == TABLOCK) {
      //  btnLock.setEnabled(false);
      //  btnLock.setSelected(true);
      }
      else if (selIndex == TABUPLOAD) {
        btnUpload.setEnabled(false);
        btnUpload.setSelected(true);
      }

      AppConnectivity connection = new AppConnectivity(getActivity().getApplicationContext());
        boolean isInternet = connection.isConnectingToInternet();
        if (!isInternet) {
          //btnUpload.setImageResource(R.drawable.btn_lock_off);
             
        }else 
        {  String resAPI = getWebApi();
          //btnUpload.setImageResource(R.drawable.btn_lock_on);
          
        }
        
       
    }
    public String getWebApi(){
      Thread a = new Thread();
      {
         MLog.d(this, "testThread");
      }
      a.start();
      String str = "";
      String url = "http://211.78.89.41/ap/WService.asmx" ;
      HttpPost httppost = new HttpPost( url ) ; 
      List <NameValuePair> params = new ArrayList <NameValuePair> ( ) ; 
      params.add ( new BasicNameValuePair ( "id" , "Frank" ) ) ; 
      try  
      {
          httppost.setEntity ( new UrlEncodedFormEntity ( params , HTTP.UTF_8 ) ) ; 

          HttpResponse res = new DefaultHttpClient () . execute ( httppost ) ; 

          if ( res.getStatusLine() .getStatusCode( ) == 200 ) //???????????200

              str = EntityUtils.toString(res.getEntity()) ;  
          MLog.d(this, "WebApiResponse"+str);
      }
      catch(Exception e)
      { }

      return str;

      }
}




Java Source Code List

com.dragonplayer.merge.FBLikeActivity.java
com.dragonplayer.merge.FacebookActivity.java
com.dragonplayer.merge.FacebookEventObserver.java
com.dragonplayer.merge.LoadingDialog.java
com.dragonplayer.merge.MainActivity.java
com.dragonplayer.merge.SplashActivity.java
com.dragonplayer.merge.TextInputActivity.java
com.dragonplayer.merge.adapter.FrameListAdapter.java
com.dragonplayer.merge.adapter.FrameSubListAdapter.java
com.dragonplayer.merge.adapter.MediaListAdapter.java
com.dragonplayer.merge.adapter.ProjectListAdapter.java
com.dragonplayer.merge.adapter.ProjectSubListAdapter.java
com.dragonplayer.merge.fragment.AboutFragment.java
com.dragonplayer.merge.fragment.AddAudioFragment.java
com.dragonplayer.merge.fragment.BaseFragment.java
com.dragonplayer.merge.fragment.FinishFragment.java
com.dragonplayer.merge.fragment.FrameFragment.java
com.dragonplayer.merge.fragment.FrameListFragment.java
com.dragonplayer.merge.fragment.GiftFragment.java
com.dragonplayer.merge.fragment.GridFragment.java
com.dragonplayer.merge.fragment.HomeFragment.java
com.dragonplayer.merge.fragment.LockConfirmFragment.java
com.dragonplayer.merge.fragment.LockFragment.java
com.dragonplayer.merge.fragment.UploadConfirmFragment.java
com.dragonplayer.merge.fragment.UploadFragment.java
com.dragonplayer.merge.fragment.UploadInfoFragment.java
com.dragonplayer.merge.fragment.UploadSelectMediaFragment.java
com.dragonplayer.merge.fragment.WorkFragment.java
com.dragonplayer.merge.frames.FrameInfo.java
com.dragonplayer.merge.frames.FramePart.java
com.dragonplayer.merge.frames.FrameView.java
com.dragonplayer.merge.frames.Frame.java
com.dragonplayer.merge.frames.FramesLayout.java
com.dragonplayer.merge.frames.Frames.java
com.dragonplayer.merge.frames.HorizontalListView.java
com.dragonplayer.merge.frames.ProjectFiles.java
com.dragonplayer.merge.frames.timeout.java
com.dragonplayer.merge.utils.AppConnectivity.java
com.dragonplayer.merge.utils.BannerData.java
com.dragonplayer.merge.utils.BitmapManager.java
com.dragonplayer.merge.utils.BitmapUtil.java
com.dragonplayer.merge.utils.Constants.java
com.dragonplayer.merge.utils.DlgWindow1.java
com.dragonplayer.merge.utils.DlgWindow2.java
com.dragonplayer.merge.utils.DlgWindow4.java
com.dragonplayer.merge.utils.DlgWindow5.java
com.dragonplayer.merge.utils.DlgWindow6.java
com.dragonplayer.merge.utils.DlgWindow7.java
com.dragonplayer.merge.utils.DlgWindow8.java
com.dragonplayer.merge.utils.FileMover.java
com.dragonplayer.merge.utils.Flag.java
com.dragonplayer.merge.utils.MLog.java
com.dragonplayer.merge.utils.SingleMediaScanner.java
com.dragonplayer.merge.utils.Utils.java
com.dragonplayer.merge.utils.WeTouch_network_interface.java
com.dragonplayer.merge.utils.WeTouch_uploadImage.java
com.dragonplayer.merge.utils.WebService.java