正在查看: bbinstant v6.24.0 应用的 KapchatAttachmentFolderViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 KapchatAttachmentFolderViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.adjetter.kapchatsdk.customattachments;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.adjetter.kapchatsdk.R;
import com.amazonaws.mobileconnectors.s3.transferutility.TransferTable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
public class KapchatAttachmentFolderViewActivity extends AppCompatActivity {
RecyclerView attachmentListView;
ActionBar actionBar = null;
String[] projection = {TransferTable.COLUMN_ID, "bucket_display_name", "datetaken", "_data"};
HashMap<String, KapchatBucketData> bucketDataHashMap = new HashMap<>();
ArrayList<KapchatGalleryStructure> imagePath = new ArrayList<>();
Boolean isHome = Boolean.TRUE;
public void homeFolderlistAdapter() {
this.isHome = Boolean.TRUE;
ArrayList arrayList = new ArrayList();
HashMap<String, KapchatBucketData> hashMap = this.bucketDataHashMap;
if (hashMap == null || hashMap.size() <= 0) {
return;
}
Iterator<KapchatBucketData> it = this.bucketDataHashMap.values().iterator();
while (it.hasNext()) {
arrayList.add(it.next().getBucketName());
}
KapchatAttachmentFolderListAdapter kapchatAttachmentFolderListAdapter = new KapchatAttachmentFolderListAdapter(this, this.bucketDataHashMap, arrayList);
this.attachmentListView.setLayoutManager(new GridLayoutManager(this, 2));
this.attachmentListView.setAdapter(kapchatAttachmentFolderListAdapter);
}
@Override
public void onBackPressed() {
if (this.isHome.booleanValue()) {
finish();
} else {
homeFolderlistAdapter();
}
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_kapchat_attachment_folder_view);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ActionBar supportActionBar = getSupportActionBar();
this.actionBar = supportActionBar;
supportActionBar.setElevation(0.0f);
this.actionBar.setDisplayHomeAsUpEnabled(true);
this.actionBar.setDisplayShowHomeEnabled(true);
this.actionBar.setDisplayUseLogoEnabled(true);
this.attachmentListView = (RecyclerView) findViewById(R.id.attachmentListView);
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
MediaStore.Files.getContentUri(Environment.getExternalStorageDirectory().getAbsolutePath());
Cursor query = getContentResolver().query(uri, this.projection, null, null, null);
if (query != null && query.getCount() > 0 && query.moveToFirst()) {
int columnIndex = query.getColumnIndex("bucket_display_name");
int columnIndex2 = query.getColumnIndex("datetaken");
int columnIndex3 = query.getColumnIndex("_data");
do {
String string = query.getString(columnIndex);
query.getString(columnIndex2);
if (this.bucketDataHashMap.get(string) == null) {
KapchatBucketData kapchatBucketData = new KapchatBucketData();
kapchatBucketData.setBucketName(string);
kapchatBucketData.setBucketImage(query.getString(columnIndex3));
this.bucketDataHashMap.put(string, kapchatBucketData);
}
} while (query.moveToNext());
}
homeFolderlistAdapter();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() != 16908332) {
return super.onOptionsItemSelected(menuItem);
}
onBackPressed();
return true;
}
public void returnResults(String str) {
Intent intent = getIntent();
intent.putExtra("selectedImage", str);
setResult(-1, intent);
finish();
}
public void subItemList(String str) {
try {
this.isHome = Boolean.FALSE;
String replace = str.replace("'", "''");
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
Cursor query = getContentResolver().query(uri, this.projection, "bucket_display_name = '" + replace + "'", null, null);
this.imagePath.clear();
StringBuilder sb = new StringBuilder();
sb.append(" query count=");
sb.append(query.getCount());
if (query.getCount() > 0) {
if (query.moveToFirst()) {
int columnIndex = query.getColumnIndex("bucket_display_name");
int columnIndex2 = query.getColumnIndex("datetaken");
int columnIndex3 = query.getColumnIndex("_data");
new HashMap();
do {
String string = query.getString(columnIndex);
String string2 = query.getString(columnIndex2);
StringBuilder sb2 = new StringBuilder();
sb2.append(" bucket=");
sb2.append(string);
sb2.append(" date_taken=");
sb2.append(string2);
sb2.append(" media ");
sb2.append(query.getString(columnIndex3));
KapchatGalleryStructure kapchatGalleryStructure = new KapchatGalleryStructure();
kapchatGalleryStructure.setDate(string2);
kapchatGalleryStructure.setName(query.getString(columnIndex3));
kapchatGalleryStructure.setFoldername(string);
kapchatGalleryStructure.setType("img");
this.imagePath.add(kapchatGalleryStructure);
} while (query.moveToNext());
}
Collections.sort(this.imagePath, new Comparator<Object>() {
@Override
public int compare(Object obj, Object obj2) {
return ((KapchatGalleryStructure) obj).getFoldername().trim().toString().compareToIgnoreCase(((KapchatGalleryStructure) obj2).getFoldername().trim().toString());
}
});
this.attachmentListView.setAdapter(new KapchatAttachmentChildAdapter(this, this.imagePath));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}