This file contains hidden or 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
package com.ecloud.ssldemo; | |
import android.content.Context; | |
import android.util.Log; | |
import com.squareup.okhttp.OkHttpClient; | |
import org.apache.http.client.ClientProtocolException; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.conn.scheme.Scheme; |
This file contains hidden or 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
private void searchExcelFile() { | |
String[] mimeTypes = {"application/vnd.ms-excel" , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}; | |
Intent searchExcel = new Intent(); | |
searchExcel.putExtra(Intent.EXTRA_ALLOW_MULTIPLE,true); | |
searchExcel.setAction(Intent.ACTION_GET_CONTENT); | |
//searchExcel.addCategory(Intent.CATEGORY_OPENABLE); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | |
searchExcel.setType(mimeTypes.length == 1 ? mimeTypes[0] : "*/*"); |
This file contains hidden or 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
/** | |
* Helper to handle Keyboard`s appearing in FullScreen dialogs. Anchoring #anchoredView bottom to | |
* keyboard`s top by manipulating #contentView vertical position. Handles case when inner EditText`s | |
* changing their height on the go. | |
* | |
* <p>Implements #LifecycleObserver to act on activity/fragments lifecycle events | |
*/ | |
public class KeyboardAnchor implements LifecycleObserver { | |
private final int ANIM_DURATION = 250; |
This file contains hidden or 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
EditText myEditText = (EditText) findViewById(R.id.myEditText); | |
myEditText.setOnKeyListener(new View.OnKeyListener() { | |
public boolean onKey(View v, int keyCode, KeyEvent event) { | |
if (keyCode == KEYCODE_ENTER) { | |
//ToDo | |
return true; | |
} | |
return false; | |
} |
This file contains hidden or 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
public static boolean isTabletDevice(Context activityContext) | |
{ | |
boolean xlarge = ((activityContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE); | |
if (xlarge) | |
{ | |
DisplayMetrics metrics = new DisplayMetrics(); | |
Activity activity = (Activity) activityContext; | |
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); |
This file contains hidden or 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
public class MyActivity extends ParentFragmentActivity | |
{ | |
@Override protected Fragment createFragment() | |
{ | |
return new MyFragment(); | |
} | |
} |
This file contains hidden or 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
public abstract class ParentFragmentActivity extends FragmentActivity | |
{ | |
protected abstract Fragment createFragment(); | |
@Override public void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_fragment); | |
FragmentManager fm = getSupportFragmentManager(); |
This file contains hidden or 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
public class MyActivity extends FragmentActivity { | |
@Override public void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_fragment); | |
FragmentManager fm = getSupportFragmentManager(); | |
Fragment fragment = fm.findFragmentById(R.id.fragmentContainer); | |
if (fragment == null) |
This file contains hidden or 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
void toHide() { | |
Process proc = null; | |
String ProcID = "79"; //HONEYCOMB AND OLDER | |
if(Build.VERSION.SDK_INT >= Build | |
.VERSION_CODES.ICE_CREAM_SANDWICH){ | |
ProcID = "42"; //ICS AND NEWER | |
} |
NewerOlder