Java 类android.app.Activity 实例源码

项目:airgram    文件:DialogsActivity.java   
@TargetApi(Build.VERSION_CODES.M)
private void askForPermissons() {
    Activity activity = getParentActivity();
    if (activity == null) {
        return;
    }
    ArrayList<String> permissons = new ArrayList<>();
    if (activity.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
        permissons.add(Manifest.permission.READ_CONTACTS);
        permissons.add(Manifest.permission.WRITE_CONTACTS);
        permissons.add(Manifest.permission.GET_ACCOUNTS);
    }
    if (activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        permissons.add(Manifest.permission.READ_EXTERNAL_STORAGE);
        permissons.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
    }
    String[] items = permissons.toArray(new String[permissons.size()]);
    activity.requestPermissions(items, 1);
}
项目:OSchina_resources_android    文件:CaptureActivityHandler.java   
@Override
public void handleMessage(Message message) {
    switch (message.what) {
        case R.id.restart_preview:
            restartPreviewAndDecode();
            break;
        case R.id.decode_succeeded:
            state = State.SUCCESS;
            Bundle bundle = message.getData();

            activity.handleDecode((Result) message.obj, bundle);
            break;
        case R.id.decode_failed:
            // We're decoding as fast as possible, so when one decode fails,
            // start another.
            state = State.PREVIEW;
            cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
            break;
        case R.id.return_scan_result:
            activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
            activity.finish();
            break;
    }
}
项目:Habitizer    文件:AddHabitActivity.java   
/**
 * Sets up view for showing completed days
 * @param ctx
 */
public static void setUpDays(Activity ctx) {
    LinearLayout daysOuter = (LinearLayout) ctx.findViewById(R.id.days_outer);
    View childdays = ctx.getLayoutInflater().inflate(R.layout.days, null);

    // Setting things

    for (int i = 0; i < 7; i++) {
        final TextView dayTextView = (TextView) childdays.findViewById(AddHabitActivity.daytags[i]);
        final int currenti = i;
        if (AddHabitActivity.days[i] == 1) {
            dayTextView.setBackground(ctx.getDrawable(R.drawable.days_border_valid));
        }

    }

    LinearLayout daysInner = (LinearLayout) childdays.findViewById(R.id.days_inner);
    daysInner.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    daysOuter.addView(childdays);

}
项目:TPlayer    文件:TDevice.java   
/**
 * 调用系统安装了的应用分享
 *
 * @param context
 * @param title
 * @param url
 */
public static void showSystemShareOption(Activity context,
                                         final String title, final String url) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, "分享:" + title);
    intent.putExtra(Intent.EXTRA_TEXT, title + " " + url);
    context.startActivity(Intent.createChooser(intent, "选择分享"));
}
项目:android-dev-challenge    文件:SettingsFragment.java   
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    Activity activity = getActivity();

    if (key.equals(getString(R.string.pref_location_key))) {
        // we've changed the location
        // Wipe out any potential PlacePicker latlng values so that we can use this text entry.
        SunshinePreferences.resetLocationCoordinates(activity);
    } else if (key.equals(getString(R.string.pref_units_key))) {
        // units have changed. update lists of weather entries accordingly
        activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null);
    }
    Preference preference = findPreference(key);
    if (null != preference) {
        if (!(preference instanceof CheckBoxPreference)) {
            setPreferenceSummary(preference, sharedPreferences.getString(key, ""));
        }
    }
}
项目:aos-Video    文件:BrowserByExtStorage.java   
@TargetApi(Build.VERSION_CODES.KITKAT)
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    if(requestCode==READ_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {

            //Set directory as default in preferences
            Uri treeUri = intent.getData();
            //grant write permissions
            getActivity().getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
            mCurrentDirectory = treeUri;
            listFiles(false);
            getLoaderManager().restartLoader(0, null, this);

        } else displayFailPage();
    }
}
项目:cardinalsSample    文件:GetPictureActivity.java   
/**
 * 获取图片成功后进行处理
 *
 * @param imagePath 图片路径
 */
private void resultImage(String imagePath) {
    Bitmap bitmap;
    if (!TextUtils.isEmpty(imagePath)) {
        bitmap = ImageUtil.getImageThumbnail(imagePath, IMAGE_MAX_SIZE, IMAGE_MAX_SIZE);
        String filePath = new File(SDUtil.getFileDir(), "temp2.jpg").getAbsolutePath();

        ImageUtil.saveImage(bitmap, filePath, 50);
        // deleteTempPicture();
        Logger.d("处理图片" + filePath);

        Intent resultIntent = new Intent();
        resultIntent.putExtra(IMAGE_PATH, filePath);
        setResult(Activity.RESULT_OK, resultIntent);
        GetPictureActivity.this.finish();

    } else {
        //没有获取到文件的路径
        ToastUtil.showShort("图片获取失败");

        setResult(Activity.RESULT_CANCELED);
        finish();
    }
}
项目:MapDemo    文件:MainActivity.java   
@Override
public void onJumpToNavigator() {
    /*
     * 设置途径点以及resetEndNode会回调该接口
     */

    for (Activity ac : activityList) {

        if (ac.getClass().getName().endsWith("BNDemoGuideActivity")) {

            return;
        }
    }
    Intent intent = new Intent(MainActivity.this,
            BNDemoGuideActivity.class);
    Bundle bundle = new Bundle();
    bundle.putSerializable(ROUTE_PLAN_NODE, mBNRoutePlanNode);
    intent.putExtras(bundle);
    startActivity(intent);

}
项目:GitHub    文件:PresenterManager.java   
@Override public void onActivityDestroyed(Activity activity) {
  if (!activity.isChangingConfigurations()) {
    // Activity will be destroyed permanently, so reset the cache
    String activityId = activityIdMap.get(activity);
    if (activityId != null) {
      ActivityScopedCache scopedCache = activityScopedCacheMap.get(activityId);
      if (scopedCache != null) {
        scopedCache.clear();
        activityScopedCacheMap.remove(activityId);
      }

      // No Activity Scoped cache available, so unregister
      if (activityScopedCacheMap.isEmpty()) {
        // All Mosby related activities are destroyed, so we can remove the activity lifecylce listener
        activity.getApplication()
            .unregisterActivityLifecycleCallbacks(activityLifecycleCallbacks);
        if (DEBUG) {
          Log.d(DEBUG_TAG, "Unregistering ActivityLifecycleCallbacks");
        }
      }
    }
  }
  activityIdMap.remove(activity);
}
项目:Camera-Roll-Android-App    文件:StorageUtil.java   
public static StorageRoot[] loadRoots(Activity context) {
    ArrayList<StorageRoot> temp = new ArrayList<>();

    StorageRoot externalStorage = new StorageRoot(
            Environment.getExternalStorageDirectory().getPath());
    externalStorage.setName(context.getString(R.string.storage));
    temp.add(externalStorage);

    File[] removableStorageRoots = getRemovableStorageRoots(context);
    for (int i = 0; i < removableStorageRoots.length; i++) {
        temp.add(new StorageRoot(removableStorageRoots[i].getPath()));
    }

    StorageRoot[] roots = new StorageRoot[temp.size()];
    return temp.toArray(roots);
}
项目:boohee_v5.6    文件:CustomSportListAdapter.java   
public void onClick(View v) {
    new Builder(CustomSportListAdapter.this.context).setMessage("确定要删除吗?")
            .setPositiveButton("删除", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            if (CustomSportListAdapter.this.data != null) {
                FoodApi.deleteCustomActivities(((CustomSport) CustomSportListAdapter.this
                        .data.get(DelListener.this.position)).id, CustomSportListAdapter
                        .this.context, new JsonCallback((Activity) CustomSportListAdapter
                        .this.context) {
                    public void onFinish() {
                        super.onFinish();
                    }

                    public void ok(JSONObject object) {
                        super.ok(object);
                        CustomSportListAdapter.this.remove(DelListener.this.position);
                        CustomSportListAdapter.this.notifyDataSetChanged();
                    }
                });
            }
        }
    }).setNegativeButton("取消", null).show();
}
项目:KTalk    文件:EaseChatRowFile.java   
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file.exists()) {
        // open files if it exist
        FileUtils.openFile(file, (Activity) context);
    } else {
        // download the file
        context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msg", message));
    }
    if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) {
        try {
            EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
        } catch (HyphenateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
项目:Gdufe-Drcom-Solution    文件:MainActivity.java   
private void forgotPsw() {
    SharedPreferences sp = getSharedPreferences(PREFERENCES_NAME, Activity.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    editor.clear();
    editor.commit();
    ed_acc.setText("");
    ed_psw.setText("");
    Toast.makeText(MainActivity.this, "已清除缓存", Toast.LENGTH_SHORT).show();
}
项目:CustomAndroidOneSheeld    文件:CameraUtils.java   
public static void setLastCapturedImagePathFromOneSheeldFolder(String lastCapturedImagePathFromOneSheeldFolder,Activity activity) {
    sharedPreferences = activity.getSharedPreferences("camera",Context.MODE_PRIVATE);
    if (lastCapturedImagePathFromOneSheeldFolder != null) {
        File tmpImage = new File(lastCapturedImagePathFromOneSheeldFolder);
        if (tmpImage.exists()) {
            CameraUtils.lastCapturedImagePathFromOneSheeldFolder = lastCapturedImagePathFromOneSheeldFolder;
            editor = sharedPreferences.edit();
            editor.putString(sharedPreferencesKey,lastCapturedImagePathFromOneSheeldFolder);
            editor.commit();
        }
    }
}
项目:SmartPermission    文件:SmartPermission.java   
@TargetApi(Build.VERSION_CODES.M)
private void executePermissionsRequest() {
    checkObjectsValid(mObject);
    if (mObject instanceof Activity) {
        ActivityCompat.requestPermissions((Activity) mObject, mPermissions, mRequestPermissionCode);
    } else if (mObject instanceof android.support.v4.app.Fragment) {
        ((android.support.v4.app.Fragment) mObject).requestPermissions(mPermissions, mRequestPermissionCode);
    } else if (mObject instanceof android.app.Fragment) {
        ((android.app.Fragment) mObject).requestPermissions(mPermissions, mRequestPermissionCode);
    }
}
项目:SocialSdkLibrary    文件:QQPlatform.java   
@Override
public void shareMusic(int shareTarget, Activity activity, ShareObj obj) {
    if (shareTarget == Target.SHARE_QQ_FRIENDS) {
        Bundle params = buildCommonBundle(obj.getTitle(), obj.getSummary(), obj.getTargetUrl(), shareTarget);
        params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_AUDIO);
        if (!TextUtils.isEmpty(obj.getThumbImagePath()))
            params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, obj.getThumbImagePath());
        params.putString(QQShare.SHARE_TO_QQ_AUDIO_URL, obj.getMediaPath());
        mTencentApi.shareToQQ(activity, params, mIUiListenerWrap);
    } else if (shareTarget == Target.SHARE_QQ_ZONE) {
        shareWeb(shareTarget, activity, obj);
    }
}
项目:silly-android    文件:SillyAndroid.java   
/**
 * Creates a new {@link android.view.ViewTreeObserver.OnGlobalLayoutListener} that attempts to calculate the keyboard size.
 * Note that this does not guarantee that a software keyboard is present, it's just a best effort detection attempt.
 * Also note that, although it's not guaranteed to work with all keyboards in all situations, this was tested against top 20 keyboards from the store and
 * had no issues detecting the changes.
 *
 * @param with    What to subscribe with (cannot be {@code null})
 * @param context The Activity context to use (cannot be {@code null})
 * @return A new instance of the layout listener. Note that this won't do anything until you attach the returned instance to the global layout by invoking
 * {@link View#getViewTreeObserver()} and then {@link ViewTreeObserver#addOnGlobalLayoutListener(ViewTreeObserver.OnGlobalLayoutListener)} on the
 * Activity's root layout, passing in the listener instance returned from this method. You also need to manually detach the listener when done listening.
 * The best practice is to do it with the {@link Activity#onStart()} and {@link Activity#onStop()} lifecycle methods.
 */
@NonNull
public static ViewTreeObserver.OnGlobalLayoutListener listenToKeyboard(@NonNull final OnKeyboardChangeListener with, @NonNull final Activity context) {
    return new ViewTreeObserver.OnGlobalLayoutListener() {
        private boolean isKeyboardVisible;

        @Override
        public void onGlobalLayout() {
            final int statusBarHeight = UI.getStatusBarHeight(context);
            final int navigationBarHeight = UI.getNavigationBarHeight(context);

            // check the display window size for the app layout
            final Rect rect = new Rect();
            context.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);

            // screen height - (user app height + status + nav) -> if non-zero, then there is a soft keyboard
            final ViewGroup layout = SillyAndroid.getContentView(context);
            if (layout == null) {
                throw new IllegalArgumentException("Passed Activity needs to have its content view set before attaching this listener");
            }
            final int keyboardHeight = layout.getRootView().getHeight() - (statusBarHeight + navigationBarHeight + rect.height());

            if (keyboardHeight <= 0) {
                if (isKeyboardVisible) {
                    with.onKeyboardHidden();
                    isKeyboardVisible = false;
                }
            } else {
                if (!isKeyboardVisible) {
                    with.onKeyboardShown(keyboardHeight);
                    isKeyboardVisible = true;
                }
            }
        }
    };
}
项目:Bigbang    文件:EasyPermissions.java   
@TargetApi(23)
private static boolean shouldShowRequestPermissionRationale(Object object, String perm) {
    if (object instanceof Activity) {
        return ActivityCompat.shouldShowRequestPermissionRationale((Activity) object, perm);
    } else if (object instanceof Fragment) {
        return ((Fragment) object).shouldShowRequestPermissionRationale(perm);
    } else if (object instanceof android.app.Fragment) {
        return ((android.app.Fragment) object).shouldShowRequestPermissionRationale(perm);
    } else {
        return false;
    }
}
项目:buildAPKsApps    文件:VolumeSettingHandler.java   
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (fromUser) {

        final AudioManager manager = (AudioManager) mActivity.getSystemService(Activity.AUDIO_SERVICE);
        final int index = (Integer) seekBar.getTag();
        final int streamType = STREAM_TYPES[index];

        // update view
        final TextView valueView = mValueViews[index];
        valueView.setText(progress + "/" + manager.getStreamMaxVolume(streamType));

        //Log.d(TAG, "onProgressChanged: index: " + index + ", value: " + progress + ", seekbar: " + seekBar);
    }
}
项目:Seccy    文件:MainActivity.java   
public void glideLoadImages(int image, ImageView[] iv)
{
    Activity activity = MainActivity.this;

    for (ImageView imgview : iv)
    {
        Glide.with(activity).load(image).into(imgview);
    }
    return;
}
项目:LucaHome-MediaServer    文件:CurrentWeatherViewController.java   
public void onCreate() {
    _logger.Debug("onCreate");

    _screenEnabled = true;

    _conditionTextView = ((Activity) _context).findViewById(R.id.weatherConditionTextView);
    _temperatureTextView = ((Activity) _context).findViewById(R.id.weatherTemperatureTextView);
    _humidityTextView = ((Activity) _context).findViewById(R.id.weatherHumidityTextView);
    _pressureTextView = ((Activity) _context).findViewById(R.id.weatherPressureTextView);
    _updatedTimeTextView = ((Activity) _context).findViewById(R.id.weatherUpdateTextView);
    _conditionImageView = ((Activity) _context).findViewById(R.id.weatherConditionImageView);
}
项目:Ships    文件:FragmentUtils.java   
public static void returnFromFragment(final Fragment fragment){
    final Activity activity=fragment.getActivity();
    if (activity!=null){
        final FragmentManager fragmentManager=activity.getFragmentManager();
        if (fragmentManager!=null) {
            fragmentManager.popBackStack();
        }
    }
}
项目:android-paypal-example    文件:ActionItemBadge.java   
public static void update(final Activity act, final MenuItem menu, IIcon icon, int badgeCount) {
    if (badgeCount == Integer.MIN_VALUE) {
        update(act, menu, new IconicsDrawable(act, icon).color(Color.WHITE).actionBar(), BadgeStyles.DARK_GREY.getStyle(), null);
    } else {
        update(act, menu, new IconicsDrawable(act, icon).color(Color.WHITE).actionBar(), BadgeStyles.DARK_GREY.getStyle(), String.valueOf(badgeCount));
    }
}
项目:Hitalk    文件:BlurDialogFragment.java   
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (mBlurEngine != null) {
        mBlurEngine.onAttach(activity); // re attached
    }
}
项目:buildAPKsApps    文件:VolumeSettingHandler.java   
public boolean prepareDialog() {

        // local cache
        final AudioManager manager = (AudioManager) mActivity.getSystemService(Activity.AUDIO_SERVICE);
        final SeekBar[] seekBars = mSeekBars;
        final TextView[] valueViews = mValueViews;
        final int[] volumes = mVolumes;
        final int length = seekBars.length;
        final int[] streamTypes = STREAM_TYPES;

        for (int i=0; i<length; i++) {

            // get value and max value
            int volume = manager.getStreamVolume(streamTypes[i]);
            int max = manager.getStreamMaxVolume(streamTypes[i]);

            // update values
            final TextView valueView = valueViews[i];
            valueView.setText(volume + "/" + max);

            // update seekbar
            SeekBar seekBar = seekBars[i];
            seekBar.setMax(max);
            seekBar.setProgress(volume);

            volumes[i] = volume; // store initial volume

            //Log.d(TAG, "prepare: index: " + i + ", value: " + volume + ", max: " + max + ", seekbar: " + seekBar);
        }
        return true;
    }
项目:Ghost-Android    文件:KeyboardUtils.java   
/**
 * Clear focus from the current view and hide the soft keyboard.
 * @param activity the current activity
 */
public static void defocusAndHideKeyboard(@Nullable Activity activity) {
    if (activity == null) return;
    View view = activity.getCurrentFocus();
    if (view != null) {
        view.clearFocus();
        hideKeyboard(activity, view.getWindowToken());
    }
}
项目:Mobike    文件:CaptureActivityHandler.java   
@Override
public void handleMessage(Message message) {
    if (message.what == R.id.auto_focus) {
        //Log.d(TAG, "Got auto-focus message");
        // When one auto focus pass finishes, start another. This is the closest thing to
        // continuous AF. It does seem to hunt getUrl bit, but I'm not sure what else to do.
        if (state == State.PREVIEW) {
            CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
        }
    } else if (message.what == R.id.restart_preview) {
        Log.d(TAG, "Got restart preview message");
        restartPreviewAndDecode();
    } else if (message.what == R.id.decode_succeeded) {
        Log.d(TAG, "Got decode succeeded message");
        state = State.SUCCESS;
        Bundle bundle = message.getData();

        /***********************************************************************/
        Bitmap barcode = bundle == null ? null :
                (Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);//���ñ����߳�

        activity.handleDecode((Result) message.obj, barcode);//���ؽ��
        /***********************************************************************/
    } else if (message.what == R.id.decode_failed) {
        // We're decoding as fast as possible, so when one decode fails, start another.
        state = State.PREVIEW;
        CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
    } else if (message.what == R.id.return_scan_result) {
        Log.d(TAG, "Got return scan result message");
        activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
        activity.finish();
    } else if (message.what == R.id.launch_product_query) {
        Log.d(TAG, "Got product query message");
        String url = (String) message.obj;
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        activity.startActivity(intent);
    }
}
项目:ulogger-android    文件:Alert.java   
/**
 * Show dialog
 * @param context Context
 * @param title Title
 * @param layoutResource Layout resource id
 * @param iconResource Icon resource id
 * @return AlertDialog Dialog
 */
static AlertDialog showAlert(Context context, CharSequence title, int layoutResource, int iconResource) {
    @SuppressLint("InflateParams")
    View view = ((Activity) context).getLayoutInflater().inflate(layoutResource, null, false);
    AlertDialog alertDialog = new AlertDialog.Builder(context).create();
    alertDialog.setTitle(title);
    alertDialog.setView(view);
    if (iconResource > 0) {
        alertDialog.setIcon(iconResource);
    }
    alertDialog.show();
    return alertDialog;
}
项目:li-android-sdk-core    文件:LiBaseRestRequestTest.java   
public void setUpTest() throws Exception {
    // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
    // inject the mocks in the test the initMocks method needs to be called.
    MockitoAnnotations.initMocks(this);

    mContext = mock(Activity.class);
}
项目:letv    文件:LiveLaunchUtils.java   
public static void launchLiveLunbo(Context context, int launchMode, String eName, boolean isLow, String programName, String cName, String channelId, String channelNum, boolean isFull) {
    setClickForPlayPageTime();
    Intent intent = new Intent(context, BasePlayActivity.class);
    intent.putExtra(PlayConstant.PLAY_TYPE, 1);
    intent.putExtra("launchMode", launchMode);
    intent.putExtra("code", eName);
    intent.putExtra(PlayConstant.LIVE_IS_LOW, isLow);
    intent.putExtra(PlayConstant.LIVE_PROGRAM_NAME, programName);
    intent.putExtra(PlayConstant.LIVE_CHANNEL_NAME, cName);
    intent.putExtra(PlayConstant.LIVE_CHANNEL_ID, channelId);
    intent.putExtra(PlayConstant.LIVE_CHANNEL_LUNBO_NUMBER, channelNum);
    intent.putExtra(PlayConstant.LIVE_FULL_ONLY, isFull);
    intent.putExtra("from", 18);
    intent.addFlags(536870912);
    Bundle bundle = new Bundle();
    bundle.putString(PlayConstant.LIVE_LAUCH_METHOD, "launchLiveLunbo");
    bundle.putString("code", eName);
    bundle.putString(PlayConstant.LIVE_PROGRAM_NAME, programName);
    bundle.putString(PlayConstant.LIVE_CHANNEL_NAME, cName);
    bundle.putString(PlayConstant.LIVE_CHANNEL_ID, channelId);
    bundle.putString(PlayConstant.LIVE_CHANNEL_LUNBO_NUMBER, channelNum);
    bundle.putBoolean(PlayConstant.LIVE_FULL_ONLY, isFull);
    LetvApplication.getInstance().setLiveLunboBundle(bundle);
    LetvLogApiTool.createPlayLogInfo("LiveLunboVideoClickPlayStart", NetworkUtils.DELIMITER_LINE, "ename=" + eName + " programName=" + programName + " isLow=" + isLow);
    if (!(context instanceof Activity)) {
        intent.addFlags(268435456);
    }
    context.startActivity(intent);
}
项目:nongbeer-mvp-android-demo    文件:MapActivity.java   
@Override
public void goToSuccessOrderActivity(){
    Intent i = new Intent( this, SuccessOrderActivity.class );
    startActivity( i );
    setResult( Activity.RESULT_OK );
    finish();
}
项目:android-lite-utils    文件:NetworkUtils.java   
/**
 * 打开网络设置界面 WIFI/流量
 *
 * @param activity
 * @param i 0:WIFI/1:流量
 */
public void openSetting(Activity activity, int i) {
    if (i == ACTION_WIFI_SETTINGS) {
        //WIFI
        activity.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
    } else if (i == ACTION_DATA_ROAMING_SETTINGS) {
        //流量
        activity.startActivity(new Intent(
                android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS));
    }
}
项目:Remindy    文件:TapTargetSequenceUtil.java   
private static void doShowTapTargetSequenceFor(@NonNull final Activity activity, @NonNull final List<TapTarget> targets, @Nullable final TapTargetSequence.Listener listener) {
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            new TapTargetSequence(activity)
                    .targets(targets)
                    .listener(listener)
                    .start();
        }
    }, DELAY);
}
项目:android-util2    文件:ImageHelper.java   
/**
 * get image by zoom
 */
public void pick(String path) {
    if (mDestroied) return;

    if(path != null){
        File file = new File(path);
        if(!file.exists()){
            throw new RuntimeException("file not exit, path = " + path);
        }
        mGalleryFile = file;
    }

    final Activity activity = getActivity();

    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image/*");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {//如果大于等于7.0使用FileProvider
        intent.putExtra(MediaStore.EXTRA_OUTPUT, getUriForFile(mGalleryFile));
        intent.addFlags(FLAG_GRANT_WRITE_URI_PERMISSION);
        intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
        activity.startActivityForResult(intent, SELECT_PIC_NOUGAT);
    } else {
        //intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mGalleryFile));
        activity.startActivityForResult(intent, IMAGE_REQUEST_CODE);
    }
}
项目:aos-Video    文件:DensityTweak.java   
public DensityTweak(Activity activity) {
    mActivity = activity;
    mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);
    mIsActualLeanbackDevice = mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);

    DensityChoices = new CharSequence[DensityChoiceIds.length];
    for (int i=0; i<DensityChoiceIds.length; i++) {
        DensityChoices[i] = mActivity.getString(DensityChoiceIds[i]);
    }
}
项目:DOUSalaries    文件:TestUtils.java   
public static void rotateOrientation(Activity activity) {
    int currentOrientation = activity.getResources().getConfiguration().orientation;

    switch (currentOrientation) {
        case Configuration.ORIENTATION_LANDSCAPE:
            rotateToPortrait(activity);
            break;
        case Configuration.ORIENTATION_PORTRAIT:
            rotateToLandscape(activity);
            break;
        default:
            rotateToLandscape(activity);
    }
}
项目:EasyEmoji    文件:ViewUtil.java   
@TargetApi(Build.VERSION_CODES.KITKAT)
public static boolean isTranslucentStatus(final Activity activity) {
    //noinspection SimplifiableIfStatement
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        return (activity.getWindow().getAttributes().flags &
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) != 0;
    }
    return false;
}
项目:asaf-project    文件:ProgressBarIdler.java   
public static void makeAllProgressBarsIdle(Instrumentation instrumentation, final Activity activity) {
    instrumentation.runOnMainSync(new Runnable() {
        public void run() {
            makeAllProgressBarsIdle(activity.findViewById(android.R.id.content).getRootView());
        }
    });
}
项目:letv    文件:Util.java   
public static void hideSoftkeyboard(Activity mActivity) {
    if (mActivity != null && mActivity.getCurrentFocus() != null) {
        InputMethodManager mInputMethodManager = (InputMethodManager) mActivity.getSystemService("input_method");
        if (mInputMethodManager != null) {
            mInputMethodManager.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), 2);
        }
    }
}
项目:DogeCV    文件:ActivityViewDisplay.java   
public void removeCurrentView(final Context context) {
    final Activity activity = (Activity) context;
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            activity.setContentView(main.getRootView());
        }
    });
}