mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-16 03:31:02 -04:00
Fullscreen screenshot view is swipable now
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/>
|
||||
</activity>
|
||||
<activity android:name=".PreferenceActivity" android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity android:name=".FullscreenImageActivity" android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity android:name=".FullscreenImageActivity" />
|
||||
<activity android:name=".SimilarAppsActivity" android:launchMode="singleInstance" android:configChanges="keyboardHidden|orientation|screenSize" >
|
||||
<meta-data android:name="android.app.default_searchable" android:value=".SearchResultActivity" />
|
||||
</activity>
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Map;
|
||||
|
||||
abstract public class DetailsDependentActivity extends AppListActivity {
|
||||
|
||||
static protected App app;
|
||||
static public App app;
|
||||
|
||||
protected App getApp() {
|
||||
return DetailsDependentActivity.app;
|
||||
|
||||
@@ -2,18 +2,18 @@ package com.github.yeriomin.yalpstore;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Gallery;
|
||||
|
||||
public class FullscreenImageActivity extends Activity {
|
||||
|
||||
static public final String INTENT_URL = "INTENT_URL";
|
||||
static public final String INTENT_SCREENSHOT_NUMBER = "INTENT_SCREENSHOT_NUMBER";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
ThemeManager.setTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
@@ -30,9 +30,14 @@ public class FullscreenImageActivity extends Activity {
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
|
||||
String url = intent.getStringExtra(INTENT_URL);
|
||||
BitmapManager manager = new BitmapManager(this);
|
||||
Bitmap bitmap = manager.getBitmap(url, true);
|
||||
((ImageView) findViewById(R.id.image)).setImageBitmap(bitmap);
|
||||
Gallery gallery = ((Gallery) findViewById(R.id.gallery));
|
||||
gallery.setAdapter(new FullscreenImageAdapter(
|
||||
this,
|
||||
DetailsDependentActivity.app.getScreenshotUrls(),
|
||||
getWindowManager().getDefaultDisplay().getWidth(),
|
||||
getWindowManager().getDefaultDisplay().getHeight()
|
||||
));
|
||||
gallery.setSelection(intent.getIntExtra(INTENT_SCREENSHOT_NUMBER, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.github.yeriomin.yalpstore;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Gallery;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class FullscreenImageAdapter extends ImageAdapter {
|
||||
|
||||
private int screenHeight;
|
||||
|
||||
FullscreenImageAdapter(Context context, List<String> screenshotUrls, int screenWidth, int screenHeight) {
|
||||
super(context, screenshotUrls, screenWidth);
|
||||
this.screenHeight = screenHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImageDownloadTask getTask() {
|
||||
ImageDownloadTask task = new ImageDownloadTask() {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
this.view.setLayoutParams(new Gallery.LayoutParams(screenWidth, screenHeight));
|
||||
this.view.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
}
|
||||
};
|
||||
task.setFullSize(true);
|
||||
return task;
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@ import java.util.List;
|
||||
|
||||
class ImageAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<String> screenshotUrls;
|
||||
private int screenWidth;
|
||||
protected Context context;
|
||||
protected List<String> screenshotUrls;
|
||||
protected int screenWidth;
|
||||
|
||||
ImageAdapter(Context context, List<String> screenshotUrls, int screenWidth) {
|
||||
this.context = context;
|
||||
@@ -39,6 +39,14 @@ class ImageAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ImageDownloadTask task = getTask();
|
||||
ImageView imageView = new ImageView(context);
|
||||
task.setView(imageView);
|
||||
task.execute((String) getItem(position));
|
||||
return imageView;
|
||||
}
|
||||
|
||||
protected ImageDownloadTask getTask() {
|
||||
ImageDownloadTask task = new ImageDownloadTask() {
|
||||
|
||||
@Override
|
||||
@@ -59,10 +67,7 @@ class ImageAdapter extends BaseAdapter {
|
||||
}
|
||||
}
|
||||
};
|
||||
ImageView imageView = new ImageView(context);
|
||||
task.setFullSize(true);
|
||||
task.setView(imageView);
|
||||
task.execute((String) getItem(position));
|
||||
return imageView;
|
||||
return task;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ScreenshotManager extends DetailsManager {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent intent = new Intent(activity, FullscreenImageActivity.class);
|
||||
intent.putExtra(FullscreenImageActivity.INTENT_URL, app.getScreenshotUrls().get(position));
|
||||
intent.putExtra(FullscreenImageActivity.INTENT_SCREENSHOT_NUMBER, position);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
<Gallery
|
||||
android:id="@+id/gallery"
|
||||
android:adjustViewBounds="true"
|
||||
android:spacing="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user