בקשה | ריכוז אפליקציות לשיאומי +Qin1s
-
ערב טוב ,
אז שיאומי +Qin1s יש לו אנדרואיד 4 , די חלש וכמעט ושום אפליקציה לא עובדת ורצה עליו,
אז אשמח לקבל ולרכז כאן אפליקציות שרצות עליו ואפשר להתקין אותם [ כמובן אחרי שינוי שם האפליקציה שאת זה אני יעשה ואז אפשר להתקין אותם, ] @אלוף-תימן אשמח לעזרה.
יש כאן קוד חלקי של גלריה שיצרתי אבל אני על נטפרי אז אני לא יכול לגמור אותה לקובץ , תודה. -
הנה הקוד .
package com.qingallery;import android.app.Activity;
import android.os.Bundle;
import android.os.Build;
import android.provider.MediaStore;
import android.database.Cursor;import android.content.Intent;
import android.content.Context;
import android.content.pm.PackageManager;import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;import android.net.Uri;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ImageView;
import android.widget.VideoView;
import android.widget.MediaController;import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;/*
- ============================================================
-
QIN GALLERY -
Gallery for old Android / QIN devices -
One Java file -
No AndroidX -
No external libraries -
No Internet -
No thumbnails - ============================================================
*/
public class MainActivity extends Activity {
/* * ---------------------------------------------------------- * CONSTANTS * ---------------------------------------------------------- */ private static final int MODE_ALL = 0; private static final int MODE_PHOTOS = 1; private static final int MODE_VIDEOS = 2; private static final int TYPE_PHOTO = 1; private static final int TYPE_VIDEO = 2; /* * ---------------------------------------------------------- * MEDIA ITEM * ---------------------------------------------------------- */ private static class MediaItem { String path; String name; int type; MediaItem(String p, String n, int t) { path = p; name = n; type = t; } } /* * ---------------------------------------------------------- * DATA * ---------------------------------------------------------- */ private ArrayList<MediaItem> allMedia = new ArrayList<MediaItem>(); private ArrayList<MediaItem> visibleMedia = new ArrayList<MediaItem>(); /* * ---------------------------------------------------------- * UI * ---------------------------------------------------------- */ private LinearLayout mainLayout; private TextView title; private ListView list; private TextView footer; /* * ---------------------------------------------------------- * STATE * ---------------------------------------------------------- */ private int currentMode = MODE_ALL; private int currentPosition = -1; /* * ========================================================== * ON CREATE * ========================================================== */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* * Keep the application simple and compatible * with old Android devices. */ requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); createInterface(); loadMedia(); updateList(); } /* * ========================================================== * CREATE INTERFACE * ========================================================== */ private void createInterface() { mainLayout = new LinearLayout(this); mainLayout.setOrientation( LinearLayout.VERTICAL ); mainLayout.setBackgroundColor( Color.rgb(18, 18, 18) ); /* * TITLE */ title = new TextView(this); title.setText("QIN GALLERY"); title.setTextColor(Color.WHITE); title.setTextSize(18); title.setGravity( Gravity.CENTER ); title.setBackgroundColor( Color.rgb(35, 35, 35) ); title.setPadding( 4, 4, 4, 4 ); mainLayout.addView( title, new LinearLayout.LayoutParams( -1, dp(42) ) ); /* * LIST */ list = new ListView(this); list.setBackgroundColor( Color.rgb(18, 18, 18) ); list.setDivider( new android.graphics.drawable.ColorDrawable( Color.rgb(60, 60, 60) ) ); list.setDividerHeight(1); mainLayout.addView( list, new LinearLayout.LayoutParams( -1, 0, 1 ) ); /* * FOOTER */ footer = new TextView(this); footer.setText( "↑ ↓ ניווט OK פתיחה MENU סינון" ); footer.setTextColor( Color.LTGRAY ); footer.setTextSize(11); footer.setGravity( Gravity.CENTER ); footer.setBackgroundColor( Color.rgb(30, 30, 30) ); mainLayout.addView( footer, new LinearLayout.LayoutParams( -1, dp(32) ) ); setContentView(mainLayout); /* * CLICK */ list.setOnItemClickListener( new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick( android.widget.AdapterView<?> parent, View view, int position, long id) { openItem(position); } } ); } /* * ========================================================== * LOAD MEDIA * ========================================================== */ private void loadMedia() { allMedia.clear(); /* * IMAGES */ Cursor imageCursor = null; try { String[] projection = { MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_ADDED }; imageCursor = getContentResolver().query( MediaStore.Images.Media .EXTERNAL_CONTENT_URI, projection, null, null, MediaStore.Images.Media .DATE_ADDED + " DESC" ); if (imageCursor != null) { int pathIndex = imageCursor.getColumnIndex( MediaStore.Images.Media.DATA ); int nameIndex = imageCursor.getColumnIndex( MediaStore.Images.Media .DISPLAY_NAME ); while (imageCursor.moveToNext()) { String path = imageCursor.getString( pathIndex ); String name = imageCursor.getString( nameIndex ); if (path != null && isImage(path)) { if (name == null) { name = new File(path) .getName(); } allMedia.add( new MediaItem( path, name, TYPE_PHOTO ) ); } } } } catch (Exception e) { // Ignore old Android MediaStore errors. } finally { if (imageCursor != null) { imageCursor.close(); } } /* * VIDEOS */ Cursor videoCursor = null; try { String[] projection = { MediaStore.Video.Media.DATA, MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.DATE_ADDED }; videoCursor = getContentResolver().query( MediaStore.Video.Media .EXTERNAL_CONTENT_URI, projection, null, null, MediaStore.Video.Media .DATE_ADDED + " DESC" ); if (videoCursor != null) { int pathIndex = videoCursor.getColumnIndex( MediaStore.Video.Media.DATA ); int nameIndex = videoCursor.getColumnIndex( MediaStore.Video.Media .DISPLAY_NAME ); while (videoCursor.moveToNext()) { String path = videoCursor.getString( pathIndex ); String name = videoCursor.getString( nameIndex ); if (path != null && isVideo(path)) { if (name == null) { name = new File(path) .getName(); } allMedia.add( new MediaItem( path, name, TYPE_VIDEO ) ); } } } } catch (Exception e) { // Ignore old Android MediaStore errors. } finally { if (videoCursor != null) { videoCursor.close(); } } /* * SORT BY FILE NAME * * This is deliberately simple. */ Collections.sort( allMedia, new Comparator<MediaItem>() { @Override public int compare( MediaItem a, MediaItem b) { return a.name .toLowerCase() .compareTo( b.name .toLowerCase() ); } } ); } /* * ========================================================== * FILTER * ========================================================== */ private void updateList() { visibleMedia.clear(); for (int i = 0; i < allMedia.size(); i++) { MediaItem item = allMedia.get(i); if (currentMode == MODE_ALL) { visibleMedia.add(item); } else if ( currentMode == MODE_PHOTOS && item.type == TYPE_PHOTO) { visibleMedia.add(item); } else if ( currentMode == MODE_VIDEOS && item.type == TYPE_VIDEO) { visibleMedia.add(item); } } if (currentMode == MODE_ALL) { title.setText( "QIN GALLERY" ); } else if (currentMode == MODE_PHOTOS) { title.setText( "PHOTOS" ); } else { title.setText( "VIDEOS" ); } footer.setText( "↑ ↓ ניווט OK פתיחה MENU החלפה" ); ArrayAdapter<MediaItem> adapter = new ArrayAdapter<MediaItem>( this, android.R.layout.simple_list_item_1, visibleMedia ) { @Override public View getView( int position, View convertView, android.view.ViewGroup parent) { TextView text; if (convertView == null) { text = new TextView( MainActivity.this ); text.setTextSize(15); text.setTextColor( Color.WHITE ); text.setGravity( Gravity.CENTER_VERTICAL ); text.setPadding( dp(10), 0, dp(5), 0 ); text.setSingleLine(true); text.setLayoutParams( new ListView.LayoutParams( -1, dp(45) ) ); } else { text = (TextView) convertView; } MediaItem item = visibleMedia .get(position); if (item.type == TYPE_VIDEO) { text.setText( "▶ " + item.name ); } else { text.setText( "▣ " + item.name ); } return text; } }; list.setAdapter(adapter); /* * Select first item. */ if (visibleMedia.size() > 0) { list.setSelection(0); } } /* * ========================================================== * OPEN ITEM * ========================================================== */ private void openItem(int position) { if (position < 0 || position >= visibleMedia.size()) { return; } currentPosition = position; MediaItem item = visibleMedia.get(position); if (item.type == TYPE_VIDEO) { openVideo(position); } else { openImage(position); } } /* * ========================================================== * IMAGE * ========================================================== */ private void openImage(int position) { if (position < 0 || position >= visibleMedia.size()) { return; } MediaItem item = visibleMedia.get(position); final Activity activity = this; requestWindowFeature( Window.FEATURE_NO_TITLE ); getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); final FrameLayout frame = new FrameLayout(this); frame.setBackgroundColor( Color.BLACK ); final ImageView image = new ImageView(this); image.setBackgroundColor( Color.BLACK ); image.setScaleType( ImageView.ScaleType.FIT_CENTER ); /* * Memory-safe image loading. * * We first read dimensions and then * choose an appropriate sample size. */ Bitmap bitmap = loadSmallBitmap( item.path, getResources() .getDisplayMetrics() .widthPixels, getResources() .getDisplayMetrics() .heightPixels ); if (bitmap != null) { image.setImageBitmap(bitmap); } else { image.setBackgroundColor( Color.rgb(20, 20, 20) ); } frame.addView( image, new FrameLayout.LayoutParams( -1, -1 ) ); setContentView(frame); /* * CENTER / OK returns to list. */ image.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } } ); /* * Physical keys. */ image.setFocusable(true); image.requestFocus(); image.setOnKeyListener( new View.OnKeyListener() { @Override public boolean onKey( View v, int keyCode, KeyEvent event) { if (event.getAction() != KeyEvent.ACTION_DOWN) { return false; } if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) { finish(); return true; } if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { previousMedia(); return true; } if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { nextMedia(); return true; } return false; } } ); } /* * ========================================================== * MEMORY SAFE BITMAP * ========================================================== */ private Bitmap loadSmallBitmap( String path, int wantedWidth, int wantedHeight) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile( path, options ); int width = options.outWidth; int height = options.outHeight; if (width <= 0 || height <= 0) { return null; } int sample = 1; /* * Keep image reasonably small. * * This is especially important on * devices with little RAM. */ while ( (width / sample) > wantedWidth * 2 || (height / sample) > wantedHeight * 2 ) { sample *= 2; } options.inJustDecodeBounds = false; options.inSampleSize = sample; options.inPreferredConfig = Bitmap.Config.RGB_565; try { return BitmapFactory.decodeFile( path, options ); } catch (OutOfMemoryError e) { /* * One more attempt with a much * smaller bitmap. */ System.gc(); options.inSampleSize = sample * 2; try { return BitmapFactory.decodeFile( path, options ); } catch (Throwable ignored) { return null; } } } /* * ========================================================== * VIDEO * ========================================================== */ private void openVideo(int position) { if (position < 0 || position >= visibleMedia.size()) { return; } final MediaItem item = visibleMedia.get(position); final Activity activity = this; requestWindowFeature( Window.FEATURE_NO_TITLE ); getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); final FrameLayout frame = new FrameLayout(this); frame.setBackgroundColor( Color.BLACK ); final VideoView video = new VideoView(this); frame.addView( video, new FrameLayout.LayoutParams( -1, -1 ) ); setContentView(frame); /* * Android's own MediaController. * * No external player library. */ final MediaController controller = new MediaController(this); controller.setAnchorView(video); video.setMediaController(controller); Uri uri = Uri.fromFile( new File(item.path) ); video.setVideoURI(uri); video.setOnPreparedListener( new android.media.MediaPlayer .OnPreparedListener() { @Override public void onPrepared( android.media.MediaPlayer mp) { /* * Start immediately. */ mp.setLooping(false); video.start(); } } ); video.setOnCompletionListener( new android.media.MediaPlayer .OnCompletionListener() { @Override public void onCompletion( android.media.MediaPlayer mp) { /* * Do not automatically * start another video. */ } } ); /* * If Android's internal player fails, * try another installed Android player. */ video.setOnErrorListener( new android.media.MediaPlayer .OnErrorListener() { @Override public boolean onError( android.media.MediaPlayer mp, int what, int extra) { try { Intent intent = new Intent( Intent.ACTION_VIEW ); intent.setDataAndType( Uri.fromFile( new File( item.path ) ), "video/*" ); startActivity(intent); return true; } catch (Exception e) { /* * Nothing else available. */ return true; } } } ); /* * Focus. */ video.setFocusable(true); video.requestFocus(); /* * Hardware keys. */ video.setOnKeyListener( new View.OnKeyListener() { @Override public boolean onKey( View v, int keyCode, KeyEvent event) { if (event.getAction() != KeyEvent.ACTION_DOWN) { return false; } if (keyCode == KeyEvent.KEYCODE_BACK) { finish(); return true; } /* * LEFT = rewind * RIGHT = forward */ if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { long pos = video.getCurrentPosition(); pos -= 10000; if (pos < 0) { pos = 0; } video.seekTo( (int) pos ); return true; } if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { long pos = video.getCurrentPosition(); pos += 10000; video.seekTo( (int) pos ); return true; } /* * CENTER = pause/play */ if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) { if (video.isPlaying()) { video.pause(); } else { video.start(); } return true; } return false; } } ); } /* * ========================================================== * NEXT / PREVIOUS * ========================================================== */ private void nextMedia() { if (visibleMedia.size() == 0) { return; } int next = currentPosition + 1; if (next >= visibleMedia.size()) { next = 0; } currentPosition = next; MediaItem item = visibleMedia.get(next); if (item.type == TYPE_VIDEO) { openVideo(next); } else { openImage(next); } } private void previousMedia() { if (visibleMedia.size() == 0) { return; } int previous = currentPosition - 1; if (previous < 0) { previous = visibleMedia.size() - 1; } currentPosition = previous; MediaItem item = visibleMedia.get(previous); if (item.type == TYPE_VIDEO) { openVideo(previous); } else { openImage(previous); } } /* * ========================================================== * KEYBOARD * ========================================================== */ @Override public boolean onKeyDown( int keyCode, KeyEvent event) { /* * BACK */ if (keyCode == KeyEvent.KEYCODE_BACK) { /* * If we're on the main list, * exit application. */ if (mainLayout != null && mainLayout.getParent() != null) { finish(); return true; } } /* * MENU / OPTIONS * * Change: * ALL -> PHOTOS -> VIDEOS -> ALL */ if (keyCode == KeyEvent.KEYCODE_MENU) { changeMode(); return true; } /* * Long press / device menu key */ if (keyCode == KeyEvent.KEYCODE_SEARCH) { changeMode(); return true; } return super.onKeyDown( keyCode, event ); } /* * ========================================================== * CHANGE FILTER * ========================================================== */ private void changeMode() { if (currentMode == MODE_ALL) { currentMode = MODE_PHOTOS; } else if ( currentMode == MODE_PHOTOS) { currentMode = MODE_VIDEOS; } else { currentMode = MODE_ALL; } updateList(); } /* * ========================================================== * FILE TYPES * ========================================================== */ private boolean isImage(String path) { String p = path.toLowerCase(); return p.endsWith(".jpg") || p.endsWith(".jpeg") || p.endsWith(".png") || p.endsWith(".gif") || p.endsWith(".bmp") || p.endsWith(".webp"); } private boolean isVideo(String path) { String p = path.toLowerCase(); return p.endsWith(".mp4") || p.endsWith(".3gp") || p.endsWith(".3gpp") || p.endsWith(".avi") || p.endsWith(".mkv") || p.endsWith(".mov") || p.endsWith(".webm") || p.endsWith(".m4v"); } /* * ========================================================== * DP * ========================================================== */ private int dp(int value) { float density = getResources() .getDisplayMetrics() .density; return (int) (value * density + 0.5f); }}
-
@לוחם-שחיתות
אם אתה מחפש יישומים שתואמים ל4.4 יש לך כאן
https://ogen-plei-qype.vercel.app/
שלום! נראה שהשיחה הזו מעניינת אותך, אבל עדיין אין לך חשבון.
נמאס לכם לגלול בין אותם הפוסטים בכל ביקור? כשנרשמים לחשבון, תמיד תחזרו בדיוק למקום שבו הייתם קודם, ותוכלו לבחור לקבל התראות על תגובות חדשות (בין אם במייל, ובין אם בהתראת פוש). תוכלו גם לשמור סימניות ולפרגן ב-upvote לפוסטים כדי להביע הערכה לחברי קהילה אחרים.
בעזרת התרומה שלך, הפוסט הזה יכול להיות אפילו טוב יותר 💗
הרשמה התחברות