pl.droidsonroids.gif.GifImageView Java Examples

The following examples show how to use pl.droidsonroids.gif.GifImageView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoadingActivity.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(getClass().getName(), "onCreate");
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_loading);

    loadingGifImageView = (GifImageView) findViewById(R.id.loadingGifImageView);
    String[] loadingAnimations = new String[] {
            "loading_colors",
            "loading_dinosaur",
            "loading_dog",
            "loading_fly",
            "loading_jellyfish",
            "loading_sky",
            "loading_space",
            "loading_spring",
            "loading_sun"
    };
    int randomIndex = (int) (Math.random() * loadingAnimations.length);
    String resourceName = loadingAnimations[randomIndex];
    Log.d(getClass().getName(), "resourceName: " + resourceName);
    int resourceId = getResources().getIdentifier(resourceName, "drawable", getPackageName());
    loadingGifImageView.setImageResource(resourceId);

    loadingNextButton = (ImageButton) findViewById(R.id.loadingNextButton);
}
 
Example #2
Source File: EmptyLayout.java    From CoreModule with Apache License 2.0 6 votes vote down vote up
private void init() {
    View view = View
            .inflate(getContext(), R.layout.emptyview_content, null);
    img = (GifImageView) view.findViewById(R.id.img_error_layout);
    tv = (TextView) view.findViewById(R.id.tv_error_layout);

    setBackgroundColor(-1);
    setOnClickListener(this);
    if (getVisibility() == View.GONE) {
        setErrorType(HIDE_LAYOUT);
    } else {
        setErrorType(NETWORK_LOADING);
    }

    img.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (clickEnable && listener != null) {
                listener.onClick(v);
            }
        }
    });

    this.addView(view);
}
 
Example #3
Source File: SamplePagerAdapter.java    From KJGallery with Apache License 2.0 6 votes vote down vote up
/**
 * 加载gif图片
 */
private void displayGif(final GifImageView gifView, byte[] res) {
    gifView.setVisibility(View.VISIBLE);

    try {
        GifDrawable gifFromBytes = new GifDrawable(res);
        gifView.setImageDrawable(gifFromBytes);
    } catch (IOException e) {
        gifView.setImageResource(R.mipmap.default_img_rect);
    }

    gifView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            aty.finish();
        }
    });
}
 
Example #4
Source File: SplashScreenActivity.java    From microbit with Apache License 2.0 5 votes vote down vote up
private void initViews() {
    mLogoLayout = (RelativeLayout) findViewById(R.id.splash_screen_logo_layout);
    mDevByText = (TextView) findViewById(R.id.splash_screen_devby_text);
    mLogo = (ImageView) findViewById(R.id.splash_screen_logo);
    mGifImageLayout = (RelativeLayout) findViewById(R.id.splash_screen_gif_image_layout);
    mGifImageFirstFrame = (ImageView) findViewById(R.id.splash_screen_gif_image_first_frame);
    mGifImage = (GifImageView) findViewById(R.id.splash_screen_gif_image);
    mLastAnimStepHandler = new Handler();

    findViewById(R.id.splash_screen_layout).setOnClickListener(this);
}
 
Example #5
Source File: GifHeadView.java    From PullToRefresh with Apache License 2.0 5 votes vote down vote up
public GifHeadView(Context context, AttributeSet attrs, int defStyleAttr)
{
	super(context, attrs, defStyleAttr);
	// TODO Auto-generated constructor stub
	LayoutInflater.from(context).inflate(R.layout.gif_headview, this, true);
	gifImageView = (GifImageView) findViewById(R.id.giv_anim);
}
 
Example #6
Source File: LoadingActivity.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(getClass().getName(), "onCreate");
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_loading);

    loadingGifImageView = (GifImageView) findViewById(R.id.loadingGifImageView);
    String[] loadingAnimations = new String[] {
            "loading_colors",
            "loading_dinosaur",
            "loading_dog",
            "loading_fly",
            "loading_jellyfish",
            "loading_sky",
            "loading_space",
            "loading_spring",
            "loading_sun"
    };
    int randomIndex = (int) (Math.random() * loadingAnimations.length);
    String resourceName = loadingAnimations[randomIndex];
    Log.d(getClass().getName(), "resourceName: " + resourceName);
    int resourceId = getResources().getIdentifier(resourceName, "drawable", getPackageName());
    loadingGifImageView.setImageResource(resourceId);

    loadingNextButton = (ImageButton) findViewById(R.id.loadingNextButton);
}
 
Example #7
Source File: SamplePagerAdapter.java    From KJGallery with Apache License 2.0 5 votes vote down vote up
@Override
public View instantiateItem(ViewGroup container, int position) {
    View root = View.inflate(aty, R.layout.item_pager, null);
    final PhotoView photoView = (PhotoView) root.findViewById(R.id.images);
    final GifImageView gifView = (GifImageView) root.findViewById(R.id.gifimage);
    final ProgressBar mProgressBar = (ProgressBar) root.findViewById(R.id.progress);

    GifRequest request = new GifRequest(imageUrls[position], new HttpCallBack() {
        @Override
        public void onPreStart() {
            super.onPreStart();
            mProgressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onSuccess(byte[] t) {
            super.onSuccess(t);
            //根据图片类型的不同选择不同的加载方案
            if (TYPE_GIF == getType(t)) {
                displayGif(gifView, t);
            } else {
                displayImage(photoView, t);
            }
        }

        @Override
        public void onFinish() {
            super.onFinish();
            mProgressBar.setVisibility(View.GONE);
        }
    });
    kjh.doRequest(request);

    container.addView(root, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams
            .MATCH_PARENT);
    return root;
}
 
Example #8
Source File: Matchers.java    From redux-android-sample with Apache License 2.0 5 votes vote down vote up
public static Matcher<View> withGifDrawable() {
    return new BoundedMatcher<View, View>(View.class) {
        @Override
        public boolean matchesSafely(View view) {
            GifImageView gifImageView = (GifImageView) view.findViewById(R.id.gif_image);
            return gifImageView.getDrawable() != null;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("with a not null drawable");
        }
    };
}
 
Example #9
Source File: Matchers.java    From redux-android-sample with Apache License 2.0 5 votes vote down vote up
public static Matcher<View> withPlayingGifDrawable() {
    return new BoundedMatcher<View, View>(View.class) {
        @Override
        public boolean matchesSafely(View view) {
            GifImageView gifImageView = (GifImageView) view.findViewById(R.id.gif_image);
            return ((GifDrawable) gifImageView.getDrawable()).isPlaying();
        }
        @Override
        public void describeTo(Description description) {
            description.appendText("with gif image view playing");
        }
    };
}
 
Example #10
Source File: FeedbackFragment.java    From ifican with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    GifDrawable drawable = (GifDrawable) ((GifImageView) v).getDrawable();
    if (drawable.isPlaying())
        drawable.stop();
    else
        drawable.start();
}
 
Example #11
Source File: TransitionsExampleFragment.java    From ifican with Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.gif1, R.id.gif2})
public void onGifClick(GifImageView view) {
    GifDrawable drawable = (GifDrawable) view.getDrawable();
    if (drawable.isPlaying())
        drawable.stop();
    else
        drawable.start();
}
 
Example #12
Source File: AtentionFragment.java    From ifican with Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.gif1, R.id.gif2, R.id.gif3})
public void onGifClick(GifImageView view) {
    GifDrawable drawable = (GifDrawable) view.getDrawable();
    if (drawable.isPlaying())
        drawable.stop();
    else
        drawable.start();
}
 
Example #13
Source File: PopUpActivity.java    From microbit with Apache License 2.0 5 votes vote down vote up
private void initViews() {
    imageIcon = (ImageView) findViewById(R.id.image_icon);
    titleTxt = (TextView) findViewById(R.id.flash_projects_title_txt);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    spinnerBar = (ProgressBar) findViewById(R.id.spinnerBar);
    messageTxt = (TextView) findViewById(R.id.messageTxt);
    layoutBottom = (LinearLayout) findViewById(R.id.popup_bottom_layout);
    okButton = (Button) findViewById(R.id.imageButtonOk);
    cancelButton = (Button) findViewById(R.id.imageButtonCancel);
    affirmationOKButton = (Button) findViewById(R.id.affirmationOKBtn);
    // Error / Flash animation
    gifImageView = (GifImageView) findViewById(R.id.pop_up_gif_image_view);

    setupFontStyle();
}
 
Example #14
Source File: ShowGIFActivity.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_show_gif);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(false);
    }

    setTitle(R.string.title_show_gif);

    String gifFilePath = getIntent().getStringExtra(GIF_PATH);
    if (gifFilePath == null) {
        return;
    }

    mGifImageView = (GifImageView) findViewById(R.id.gif_image_view);
    try {
        GifDrawable drawable = new GifDrawable(gifFilePath);
        drawable.start();
        drawable.setLoopCount(10);
        mGifImageView.setBackground(drawable);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example #15
Source File: ContextFragment.java    From ifican with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.gif1)
public void onGifClick(GifImageView view) {
    GifDrawable drawable = (GifDrawable) view.getDrawable();
    if (drawable.isPlaying())
        drawable.stop();
    else
        drawable.start();
}
 
Example #16
Source File: GifFragment.java    From leafpicrevived with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
                         ViewGroup container,
                         Bundle savedInstanceState) {

    GifImageView photoView = new GifImageView(getContext());
    photoView.setImageURI(media.getUri());
    setTapListener(photoView);
    return photoView;
}
 
Example #17
Source File: Utils.java    From ifican with Apache License 2.0 5 votes vote down vote up
public static void startGif(GifImageView view) {
    GifDrawable drawable = (GifDrawable) view.getDrawable();
    if (!drawable.isPlaying()) {
        drawable.reset();
        drawable.start();
    }
}
 
Example #18
Source File: AuthenticationActivity.java    From ml-authentication with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_authentication);

    //Usage of this flag was inactivated in AuthenticationActivity and StudentImageCollectionActivity on 20170129
    /*isDeviceRooted = getIntent().getBooleanExtra(AuthenticationThread.IS_DEVICE_ROOTED_IDENTIFIER, false);

    if (isDeviceRooted){
        screenBrightnessMode = DetectionHelper.getScreenBrightnessMode(getApplicationContext());
        screenBrightness = DetectionHelper.getScreenBrightness(getApplicationContext());
        displayTemperatureNight = DetectionHelper.getDisplayTemperatureNight();
    }*/

    authenticationAnimation = (GifImageView) findViewById(R.id.authentication_animation);
    AuthenticationInstructionHelper.setAuthenticationInstructionAnimation(getApplicationContext(), authenticationAnimation);

    // Initialize DB Session
    LiteracyApplication literacyApplication = (LiteracyApplication) getApplicationContext();
    DaoSession daoSession = literacyApplication.getDaoSession();
    studentImageCollectionEventDao = daoSession.getStudentImageCollectionEventDao();
    authenticationEventDao = daoSession.getAuthenticationEventDao();

    if (!readyForAuthentication()){
        startStudentImageCollectionActivity(false);
    }

    preview = (JavaCameraView) findViewById(R.id.CameraView);

    // Use front-camera
    preview.setCameraIndex(1);

    preview.setVisibility(SurfaceView.VISIBLE);
    preview.setCvCameraViewListener(this);

    final TrainingThread trainingThread = new TrainingThread(getApplicationContext());

    tensorFlowLoadingThread = new Thread(new Runnable() {
        @Override
        public void run() {
            tensorFlow = trainingThread.getInitializedTensorFlow();
        }
    });

    recognitionThreadStarted = false;

    animalOverlayHelper = new AnimalOverlayHelper(getApplicationContext());

    activityStopped = false;
}
 
Example #19
Source File: AuthenticationActivity.java    From ml-authentication with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_authentication);

    //Usage of this flag was inactivated in AuthenticationActivity and StudentImageCollectionActivity on 20170129
    /*isDeviceRooted = getIntent().getBooleanExtra(AuthenticationThread.IS_DEVICE_ROOTED_IDENTIFIER, false);

    if (isDeviceRooted){
        screenBrightnessMode = DetectionHelper.getScreenBrightnessMode(getApplicationContext());
        screenBrightness = DetectionHelper.getScreenBrightness(getApplicationContext());
        displayTemperatureNight = DetectionHelper.getDisplayTemperatureNight();
    }*/

    authenticationAnimation = (GifImageView) findViewById(R.id.authentication_animation);
    AuthenticationInstructionHelper.setAuthenticationInstructionAnimation(getApplicationContext(), authenticationAnimation);

    // Initialize DB Session
    LiteracyApplication literacyApplication = (LiteracyApplication) getApplicationContext();
    DaoSession daoSession = literacyApplication.getDaoSession();
    studentImageCollectionEventDao = daoSession.getStudentImageCollectionEventDao();
    authenticationEventDao = daoSession.getAuthenticationEventDao();

    if (!readyForAuthentication()){
        startStudentImageCollectionActivity(false);
    }

    preview = (JavaCameraView) findViewById(R.id.CameraView);

    // Use front-camera
    preview.setCameraIndex(1);

    preview.setVisibility(SurfaceView.VISIBLE);
    preview.setCvCameraViewListener(this);

    final TrainingThread trainingThread = new TrainingThread(getApplicationContext());

    tensorFlowLoadingThread = new Thread(new Runnable() {
        @Override
        public void run() {
            tensorFlow = trainingThread.getInitializedTensorFlow();
        }
    });

    recognitionThreadStarted = false;

    animalOverlayHelper = new AnimalOverlayHelper(getApplicationContext());

    activityStopped = false;
}
 
Example #20
Source File: Utils.java    From ifican with Apache License 2.0 4 votes vote down vote up
public static void stopGif(GifImageView view) {
    GifDrawable drawable = (GifDrawable) view.getDrawable();
    if (drawable.isPlaying())
        drawable.stop();
}
 
Example #21
Source File: ImagesLookerPhotoViewFragment.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
private void showImage(String url) {
    String filedir = ImageLoader.getInstance().getDiskCache().get(url).getPath();

    Log.v("APP", "url:" + url + " filedir:" + filedir);
    Log.v("APP", "imageView.getClass().getName():" + imageView.getClass().getName());


    if (imageView instanceof PhotoView) {

        ImageLoader.getInstance().displayImage("file://"+filedir,imageView);

    } else if (imageView instanceof GifView) {
        GifDrawable gifFromPath = getGif(filedir);
        ((GifImageView) imageView).setImageDrawable(gifFromPath);
    }

    rpb.setVisibility(View.GONE);

}
 
Example #22
Source File: WiFiNetworkListItemAdapter.java    From arcusandroid with Apache License 2.0 4 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    int type = getItemViewType(position);

    if (convertView == null) {
        holder = new ViewHolder();
        switch (type) {
            case TYPE_ITEM:
                convertView = inflater.inflate(R.layout.list_item_network_device, null);
                holder.titleView = (TextView) convertView.findViewById(R.id.tv_network_name);
                holder.securityView = (ImageView) convertView.findViewById(R.id.iv_network_availability);
                holder.signalView = (ImageView) convertView.findViewById(R.id.iv_signal_strength);
                break;
            case TYPE_LOADING:
                convertView = inflater.inflate(R.layout.list_item_loading, null);
                holder.loadingView = (GifImageView) convertView.findViewById(R.id.loading_image);
                break;
        }
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder)convertView.getTag();
    }

    if (isLoading && position == 0) {
        holder.loadingView = new GifImageView(context);
        holder.loadingView.setImageResource(R.drawable.preloader_black);
        holder.loadingView.setMaxWidth(ImageUtils.dpToPx(context, 50));
        holder.loadingView.setMaxHeight(ImageUtils.dpToPx(context, 50));
        holder.loadingView.setAdjustViewBounds(true);
    } else {

        AvailableNetworkModel data = items.get(isLoading ? 0 : position);

        String ssid = data.getSSID();
        WiFiSecurityType security = data.getSecurity();
        Integer signalStrength = data.getSignal();

        if (data.isCustom()) {
            holder.titleView.setText("Custom");
            holder.securityView.setVisibility(View.INVISIBLE);
            holder.signalView.setVisibility(View.INVISIBLE);
        } else {
            holder.titleView.setText(ssid);
            holder.securityView.setVisibility(View.VISIBLE);
            holder.signalView.setVisibility(View.VISIBLE);

    /* set up image for network state */
            if (security == null || security.compareTo(WiFiSecurityType.NONE) == 0) {
                holder.securityView.setVisibility(View.INVISIBLE);
            } else {
                holder.securityView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.lock));
            }

    /* set up image for signal strength */
            if (signalStrength == null) return convertView;

            if ((signalStrength / 33) == 0) {
                holder.signalView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.wifi_33));
            } else if ((signalStrength / 33) == 1) {
                holder.signalView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.wifi_66));
            } else if ((signalStrength / 33) >= 2) {
                holder.signalView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.wifi_100));
            }
        }
    }

    return convertView;
}
 
Example #23
Source File: FragmentShearedMedia.java    From iGap-Android with GNU Affero General Public License v3.0 4 votes vote down vote up
public ViewHolder(View view) {
    super(view);

    gifView = (GifImageView) itemView.findViewById(R.id.smslg_gif_view);
}
 
Example #24
Source File: PairingActivity.java    From microbit with Apache License 2.0 4 votes vote down vote up
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
    logi("mLeScanCallback.onLeScan() [+]");

    if(!scanning) {
        return;
    }

    if(device == null) {
        return;
    }

    if((newDeviceName.isEmpty()) || (device.getName() == null)) {
        logi("mLeScanCallback.onLeScan() ::   Cannot Compare " + device.getAddress() + " " + rssi + " " + Arrays.toString(scanRecord));
    } else {
        String s = device.getName().toLowerCase();
        //Replace all : to blank - Fix for #64
        //TODO Use pattern recognition instead
        s = s.replaceAll(":", "");
        if(newDeviceName.toLowerCase().startsWith(s)) {
            logi("mLeScanCallback.onLeScan() ::   Found micro:bit -" + device.getName().toLowerCase() + " " +
                    device.getAddress());
            // Stop scanning as device is found.
            stopScanning();
            newDeviceAddress = device.getAddress();
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    TextView textView = (TextView) findViewById(R.id.search_microbit_step_3_title);
                    TextView tvSearchingStep = (TextView) findViewById(R.id.searching_microbit_step);
                    TextView tvSearchingInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
                    if(textView != null) {
                        textView.setText(getString(R.string.searchingTitle));
                        findViewById(R.id.searching_progress_spinner).setVisibility(View.GONE);
                        ((GifImageView) findViewById(R.id.searching_microbit_found_giffview))
                                .setImageResource(R.drawable.emoji_microbit_found);
                        if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
                            tvSearchingStep.setText(R.string.searching_microbit_found_message_one_line);
                        } else {
                            tvSearchingStep.setText(R.string.searching_microbit_found_message);
                        }
                        tvSearchingInstructions.setText(R.string.searching_tip_text_instructions);
                        startPairingSecureBle(device);
                    }
                }
            });
        } else {
            logi("mLeScanCallback.onLeScan() ::   Found - device.getName() == " + device.getName().toLowerCase()
                    + " , device address - " + device.getAddress());
        }
    }
}
 
Example #25
Source File: PairingActivity.java    From microbit with Apache License 2.0 4 votes vote down vote up
/**
 * Displays needed screen according to a pairing state and
 * allows to navigate through the connection screens.
 *
 * @param gotoState New pairing state.
 */
private void displayScreen(PAIRING_STATE gotoState) {
    //Reset all screens first
    pairTipView.setVisibility(View.GONE);
    newDeviceView.setVisibility(View.GONE);
    pairSearchView.setVisibility(View.GONE);
    connectDeviceView.setVisibility(View.GONE);

    logi("********** Connect: state from " + pairingState + " to " + gotoState);
    pairingState = gotoState;

    boolean mDeviceListAvailable = ((gotoState == PAIRING_STATE.PAIRING_STATE_CONNECT_BUTTON) ||
            (gotoState == PAIRING_STATE.PAIRING_STATE_ERROR));

    if(mDeviceListAvailable) {
        updatePairedDeviceCard();
        connectDeviceView.setVisibility(View.VISIBLE);
    }

    switch(gotoState) {
        case PAIRING_STATE_CONNECT_BUTTON:
            break;

        case PAIRING_STATE_ERROR:
            Arrays.fill(DEVICE_CODE_ARRAY, 0);
            findViewById(R.id.enter_pattern_step_2_gridview).setEnabled(true);
            newDeviceName = "";
            newDeviceCode = "";
            break;

        case PAIRING_STATE_STEP_1:
            pairTipView.setVisibility(View.VISIBLE);
            findViewById(R.id.ok_tip_step_1_btn).setOnClickListener(this);
            break;

        case PAIRING_STATE_STEP_2:
            newDeviceView.setVisibility(View.VISIBLE);
            findViewById(R.id.cancel_enter_pattern_step_2_btn).setVisibility(View.VISIBLE);
            findViewById(R.id.enter_pattern_step_2_title).setVisibility(View.VISIBLE);
            findViewById(R.id.oh_pretty_emoji).setVisibility(View.VISIBLE);

            displayLedGrid();
            break;

        case PAIRING_STATE_SEARCHING:
            if(pairSearchView != null) {
                pairSearchView.setVisibility(View.VISIBLE);
                TextView tvTitle = (TextView) findViewById(R.id.search_microbit_step_3_title);
                TextView tvSearchingStep = (TextView) findViewById(R.id.searching_microbit_step);
                tvSearchingStep.setContentDescription(tvSearchingStep.getText());
                TextView tvSearchingInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
                if(tvTitle != null) {
                    tvTitle.setText(R.string.searchingTitle);
                    findViewById(R.id.searching_progress_spinner).setVisibility(View.VISIBLE);
                    ((GifImageView) findViewById(R.id.searching_microbit_found_giffview))
                            .setImageResource(R.drawable.pairing_pin_screen_two);
                    if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
                        tvSearchingStep.setText(R.string.searching_tip_step_text_one_line);
                    } else {
                        tvSearchingStep.setText(R.string.searching_tip_step_text);
                    }
                    tvSearchingInstructions.setText(R.string.searching_tip_text_instructions);
                }
                justPaired = true;
            } else {
                justPaired = false;
            }
            break;
    }
}
 
Example #26
Source File: HomeActivity.java    From microbit with Apache License 2.0 4 votes vote down vote up
/**
 * Initializes the gif image and sets a resource.
 */
private void initGifImage() {
    gifAnimationHelloEmoji = (GifImageView) findViewById(R.id.homeHelloAnimationGifView);
    gifAnimationHelloEmoji.setImageResource(R.drawable.hello_emoji_animation);
}
 
Example #27
Source File: MediaActivity.java    From WhereYouGo with GNU General Public License v3.0 4 votes vote down vote up
protected void setMedia(Media media) {
    if (media == null)
        return;
    if (media.id == cachedMediaId)
        return;
    TextView textView = (TextView) findViewById(R.id.mediaTextView);
    textView.setText(UtilsGUI.simpleHtml(media.altText));
    if (media.type == null)
        return;
    View view = null;
    switch (media.type.toLowerCase()) {
        case "mp4":
            view = findViewById(R.id.mediaVideoView);
        break;
        case "gif":
            view = findViewById(R.id.mediaGifView);
        break;
        case "jpeg":
        case "jpg":
        case "png":
        case "bmp":
            view = findViewById(R.id.mediaImageView);
    }
    if (view == null)
        return;
    byte[] data = null;
    try {
        data = Engine.mediaFile(media);
    } catch (Exception e) {
        return;
    }
    if (view.getId() == R.id.mediaImageView) {
        Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
        bmp = Images.resizeBitmap(bmp);
        ((ImageView) view).setImageBitmap(bmp);
    } else {
        // save file to cache
        String filename = FileSystem.CACHE + media.jarFilename();
        FileSystem.saveBytes(filename, data);
        File file = new File(filename);
        Uri uri = Uri.fromFile(file);
        if (view.getId() == R.id.mediaGifView) {
            ((GifImageView) view).setImageURI(uri);
        } else if (view.getId() == R.id.mediaVideoView) {
            ((VideoView) view).setVideoURI(uri);
        }
    }
    view.setVisibility(View.VISIBLE);
    cachedMediaId = media.id;
}
 
Example #28
Source File: StudentImageCollectionActivity.java    From ml-authentication with Apache License 2.0 2 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_authentication_student_image_collection);

    //Usage of this flag was inactivated in AuthenticationActivity and StudentImageCollectionActivity on 20170129
    /*isDeviceRooted = getIntent().getBooleanExtra(AuthenticationThread.IS_DEVICE_ROOTED_IDENTIFIER, false);

    if (isDeviceRooted){
        screenBrightnessMode = DetectionHelper.getScreenBrightnessMode(getApplicationContext());
        screenBrightness = DetectionHelper.getScreenBrightness(getApplicationContext());
        displayTemperatureNight = DetectionHelper.getDisplayTemperatureNight();
    }*/

    authenticationAnimation = (GifImageView) findViewById(R.id.authentication_animation);
    AuthenticationInstructionHelper.setAuthenticationInstructionAnimation(getApplicationContext(), authenticationAnimation);

    animalOverlayName = getIntent().getStringExtra(AuthenticationActivity.ANIMAL_OVERLAY_IDENTIFIER);

    preview = (JavaCameraView) findViewById(R.id.CameraView);

    preview.setCameraIndex(1);

    preview.setVisibility(SurfaceView.VISIBLE);
    preview.setCvCameraViewListener(this);

    lastTime = new Date().getTime();

    // Reset imageProcessed counter
    imagesProcessed = 0;

    // Initialize DB Session
    literacyApplication = (LiteracyApplication) getApplicationContext();
    DaoSession daoSession = literacyApplication.getDaoSession();
    studentImageCollectionEventDao = literacyApplication.getDaoSession().getStudentImageCollectionEventDao();

    // Create required DB Objects
    studentImageCollectionEventDao = daoSession.getStudentImageCollectionEventDao();
    studentImageDao = daoSession.getStudentImageDao();

    device = DeviceInfoHelper.getDevice(getApplicationContext());

    studentImages = new ArrayList<>();

    animalOverlayHelper = new AnimalOverlayHelper(getApplicationContext());

    activityStopped = false;

    authenticationAnimationAlreadyPlayed = getIntent().getBooleanExtra(AuthenticationActivity.AUTHENTICATION_ANIMATION_ALREADY_PLAYED_IDENTIFIER, false);
}
 
Example #29
Source File: StudentImageCollectionActivity.java    From ml-authentication with Apache License 2.0 2 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_authentication_student_image_collection);

    //Usage of this flag was inactivated in AuthenticationActivity and StudentImageCollectionActivity on 20170129
    /*isDeviceRooted = getIntent().getBooleanExtra(AuthenticationThread.IS_DEVICE_ROOTED_IDENTIFIER, false);

    if (isDeviceRooted){
        screenBrightnessMode = DetectionHelper.getScreenBrightnessMode(getApplicationContext());
        screenBrightness = DetectionHelper.getScreenBrightness(getApplicationContext());
        displayTemperatureNight = DetectionHelper.getDisplayTemperatureNight();
    }*/

    authenticationAnimation = (GifImageView) findViewById(R.id.authentication_animation);
    AuthenticationInstructionHelper.setAuthenticationInstructionAnimation(getApplicationContext(), authenticationAnimation);

    animalOverlayName = getIntent().getStringExtra(AuthenticationActivity.ANIMAL_OVERLAY_IDENTIFIER);

    preview = (JavaCameraView) findViewById(R.id.CameraView);

    preview.setCameraIndex(1);

    preview.setVisibility(SurfaceView.VISIBLE);
    preview.setCvCameraViewListener(this);

    lastTime = new Date().getTime();

    // Reset imageProcessed counter
    imagesProcessed = 0;

    // Initialize DB Session
    literacyApplication = (LiteracyApplication) getApplicationContext();
    DaoSession daoSession = literacyApplication.getDaoSession();
    studentImageCollectionEventDao = literacyApplication.getDaoSession().getStudentImageCollectionEventDao();

    // Create required DB Objects
    studentImageCollectionEventDao = daoSession.getStudentImageCollectionEventDao();
    studentImageDao = daoSession.getStudentImageDao();

    device = DeviceInfoHelper.getDevice(getApplicationContext());

    studentImages = new ArrayList<>();

    animalOverlayHelper = new AnimalOverlayHelper(getApplicationContext());

    activityStopped = false;

    authenticationAnimationAlreadyPlayed = getIntent().getBooleanExtra(AuthenticationActivity.AUTHENTICATION_ANIMATION_ALREADY_PLAYED_IDENTIFIER, false);
}
 
Example #30
Source File: MyMainActivity.java    From a with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void updateUI(){

    String logo_path = preferences.getString(getResources().getString(R.string.pk_logo_path), "");

    GifImageView logoPath =  navigationView.getHeaderView(0).findViewById(R.id.logo_path);

    File f=new File(logo_path);

    if(f.exists()){
        //logoPath.setImageURI(Uri.parse(logo_path));

        try {

            if(logo_path.toLowerCase().endsWith(".gif")) {
                GifDrawable gifDrawable = new GifDrawable(f);

                logoPath.setImageDrawable(gifDrawable);
            }else{
                logoPath.setImageURI(Uri.parse(logo_path));
            }
        }catch (IOException e) {
            e.printStackTrace();
        }


    }else{

        logoPath.setImageResource(R.drawable.ebook);
    }


    String logo_title = preferences.getString(getResources().getString(R.string.pk_logo_title), "");
    String logo_title_align = preferences.getString(getResources().getString(R.string.pk_logo_title_align), "0");

    TextView logoTitle = navigationView.getHeaderView(0).findViewById(R.id.logo_title);

    if(!TextUtils.isEmpty(logo_title)) {
        logoTitle.setText(logo_title);
    }else{
        logoTitle.setText(R.string.read_summary);
    }


    //此处判断容易卡

    //网络格言判断
    /*
    Boolean use_network = preferences.getBoolean(getResources().getString(R.string.pk_logo_title_use_network),true);

    if(use_network && isNetWorkAvailable()){

        String url = preferences.getString(getResources().getString(R.string.pk_logo_title_api), "");

        mPresenter.getRemoteTitle(url);
    }
    */

    switch (logo_title_align) {
        case "0":
            logoTitle.setGravity(Gravity.LEFT);
            break;
        case "1":
            logoTitle.setGravity(Gravity.CENTER);
            break;

        case "2":
            logoTitle.setGravity(Gravity.RIGHT);
            break;

    }



}