Skip to content

Commit 4d51d2d

Browse files
committed
new implement of recycler view, beautiful entry
1 parent 350a566 commit 4d51d2d

22 files changed

+486
-329
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
12-
<activity android:name=".login.LoginActivity"></activity>
12+
<activity android:name=".login.LoginActivity" ></activity>
1313
<activity android:name=".VaultActivity" android:exported="false"/>
1414
<activity android:name=".ImageViewerActivity" android:exported="false"/>
1515
<activity android:name=".login.SetPasswordActivity" android:exported="false"/>
16-
<activity android:name=".EntryActivity">
16+
<activity android:name=".EntryActivity" android:theme="@style/hideTitle">
1717
<intent-filter>
1818
<action android:name="android.intent.action.MAIN" />
1919

app/src/main/java/com/katcom/androidFileVault/Crypto.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,19 @@ public interface Crypto {
2727
writeData(in,out);
2828
2929
}*/
30+
/*public CipherOutputStream getDecryptedInputStream(String filepath){
31+
32+
}*/
33+
34+
/**
35+
* This method returns an IntputStream pointed to an encrypted file which decrypts file on the fly.
36+
* In other words, it is connected to an encrypted file, when you read data via the CipherOutputStream,
37+
* you get the decrypted data instead of the encrypted.
38+
*
39+
* @param filepath
40+
* @return
41+
*/
42+
CipherOutputStream getDecryptedInputStream(String filepath);
43+
3044

3145
}

app/src/main/java/com/katcom/androidFileVault/DataBase/VaultDbSchema.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.katcom.androidFileVault.DataBase;
22

3+
/**
4+
* This class
5+
*/
36
public class VaultDbSchema {
4-
public static final class VaultTable{
7+
public static final class VaultTable {
58
public static final String TABLE_NAME = "User";
69
public static final String COLUMN_VAULT_NAME = "vault_name";
710
public static final String PASSWORD = "password";
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.katcom.androidFileVault;
2+
3+
public interface FileOpener {
4+
void openFile(ProtectedFile file);
5+
6+
void openPdf(ProtectedFile file);
7+
8+
void openDocx(ProtectedFile file);
9+
10+
void openTxt(ProtectedFile file);
11+
12+
void openVideo(ProtectedFile file);
13+
14+
void openAudio(ProtectedFile file);
15+
16+
void openPicture(ProtectedFile file);
17+
18+
}
Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,57 @@
11
package com.katcom.androidFileVault;
22

3-
public interface SecureFileOpener {
4-
void openFile(String filename);
3+
import android.content.Context;
4+
import android.content.Intent;
55

6-
void openPdf(String filename);
6+
public class SecureFileOpener implements FileOpener {
7+
private Context mContext;
8+
private static SecureFileOpener mFileOpener;
9+
private SecureFileOpener(Context context){
10+
mContext =context;
11+
}
12+
public static SecureFileOpener getInstance(Context context){
13+
if(mFileOpener == null){
14+
mFileOpener = new SecureFileOpener(context);
15+
}
16+
return mFileOpener;
17+
}
18+
@Override
19+
public void openFile(ProtectedFile file) {
720

8-
void openDocx(String filename);
21+
}
922

10-
void openTxt(String filename);
23+
@Override
24+
public void openPdf(ProtectedFile file) {
1125

12-
void openVideo(String filename);
26+
}
1327

14-
void openAudio(String filename);
28+
@Override
29+
public void openDocx(ProtectedFile file) {
1530

16-
void openPicture(String filename);
31+
}
1732

33+
@Override
34+
public void openTxt(ProtectedFile file) {
35+
36+
}
37+
38+
@Override
39+
public void openVideo(ProtectedFile file) {
40+
41+
}
42+
43+
@Override
44+
public void openAudio(ProtectedFile file) {
45+
46+
}
47+
48+
@Override
49+
public void openPicture(ProtectedFile file) {
50+
Intent intent = ImageViewerActivity.newIntent(mContext, file.getFilename(), file.getFilepath());
51+
mContext.startActivity(intent);
52+
}
53+
54+
public void openBasedOnFileType(ProtectedFile file){
55+
openPicture(file);
56+
}
1857
}

app/src/main/java/com/katcom/androidFileVault/SecureFileViewer.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

app/src/main/java/com/katcom/androidFileVault/SingleFragmentActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.katcom.androidFileVault;
22

33
import android.os.Bundle;
4+
5+
import androidx.appcompat.app.AppCompatActivity;
46
import androidx.fragment.app.Fragment;
57
import androidx.fragment.app.FragmentActivity;
68
import androidx.fragment.app.FragmentManager;
79

8-
public abstract class SingleFragmentActivity extends FragmentActivity {
10+
public abstract class SingleFragmentActivity extends AppCompatActivity {
911
protected abstract Fragment createFragment();
1012

1113
@Override
Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.katcom.androidFileVault;
22

3+
import android.view.Menu;
4+
import android.view.MenuInflater;
5+
36
import androidx.fragment.app.Fragment;
47
import androidx.appcompat.app.AppCompatActivity;
58

@@ -8,44 +11,10 @@ public class VaultActivity extends SingleFragmentActivity {
811
protected Fragment createFragment() {
912
return new VaultFragment();
1013
}
11-
12-
/*private DrawerLayout mDrawer;
13-
private NavigationView mNavigation;
14-
@Override
15-
protected void onCreate(Bundle savedInstanceState) {
16-
super.onCreate(savedInstanceState);
17-
setContentView(R.layout.activity_vault);
18-
19-
mDrawer = findViewById(R.id.drawer_layout);
20-
mNavigation = findViewById(R.id.navigation_view);
21-
22-
mNavigation.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
23-
@Override
24-
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
25-
int id = menuItem.getItemId();
26-
return false;
27-
}
28-
});
29-
30-
File file = new File(this.getFilesDir() + "/FileVaultOne");
31-
if(!file.exists()){
32-
file.mkdir();
33-
}
34-
Utils.copyFilesFromAsset(this.getApplicationContext(),"sample_files","FileVaultOne");
35-
36-
}
37-
3814
@Override
39-
public boolean onCreateOptionsMenu(Menu menu){
40-
getMenuInflater().inflate(R.menu.export_menu,menu);
15+
public boolean onCreateOptionsMenu(Menu menu) {
16+
MenuInflater inflater = getMenuInflater();
4117
return true;
4218
}
4319

44-
@Override
45-
public boolean onOptionsItemSelected(MenuItem item){
46-
switch (item.getItemId()){
47-
48-
}
49-
return true;
50-
}*/
5120
}

0 commit comments

Comments
 (0)